Skip to content

Commit

Permalink
chore: update angular to v10 rc and publishing process
Browse files Browse the repository at this point in the history
This also includes updated publishing instructions and process for Clarity.

Signed-off-by: Jeremy Wilken <[email protected]>
  • Loading branch information
gnomeontherun committed Jun 17, 2020
1 parent 8886b4f commit a43f782
Show file tree
Hide file tree
Showing 15 changed files with 562 additions and 443 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ Thumbs.db

# Local Netlify folder
.netlify

# Yarn
yarn-error.log

# Release test
release-test/
16 changes: 16 additions & 0 deletions docs/PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Publishing Clarity

The workflow for building and publishing Clarity is found below. This assumes you are working on the default branch of the repository for this version.

1. Run `yarn build` from the root. This will build and test everything just like a normal CI build.
2. Update the version found in the root `package.json` file to the new version, then run `yarn publish:version` to sync the version across the project.
3. Update the website release notes files as necessary to track changes and documentation.
4. Commit the changes with format like `chore: release v4.0.0`. Also tag it with a version tag like `v4.0.0`.
5. Run a publish script, depending on what type of release you are doing:

- `yarn publish:latest` this is a standard release for the latest version of Clarity.
- `yarn publish:next` this is a prerelease version for the next Clarity release.
- `yarn publish:rc` this is a release candidate version for the next Clarity release.
- `yarn publish:local` this is a test candidate for local development with verdaccio.

6. Push the changes to Clarity branch on GitHub.
20 changes: 13 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
"name": "clarity",
"version": "3.1.0",
"version": "4.0.0-next.0",
"private": true,
"workspaces": {
"packages": ["packages/*", "apps/*"],
"packages": [
"packages/*",
"apps/*"
],
"nohoist": [
"angular/@angular/**",
"angular/@angular-devkit/**",
"core/css-vars-ponyfill",
"core/tslib",
"core/lit-element",
Expand Down Expand Up @@ -37,11 +42,12 @@
"format:fix": "pretty-quick --staged",
"format:file": "prettier --write .",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"publish:prepare": "npm-run-all clean ngcc:fix build:libs",
"publish:latest": "yarn publish:prepare; yarn ngcc:fix; yarn angular:build:package; yarn core:build:package; yarn publish dist/core; yarn publish dist/clr-ui; yarn publish dist/clr-angular; yarn publish dist/clr-icons",
"publish:next": "yarn publish:prepare; yarn publish dist/core --tag next; yarn publish dist/clr-ui --tag next; yarn publish dist/clr-angular --tag next; yarn publish dist/clr-icons --tag next",
"publish:rc": "yarn publish:prepare; yarn publish dist/core --tag rc; yarn publish dist/clr-ui --tag rc; yarn publish dist/clr-angular --tag rc; yarn publish dist/clr-icons --tag rc",
"publish:local": "yarn publish:prepare; yarn publish dist/core --registry http://localhost:4873; yarn publish dist/clr-ui --registry http://localhost:4873; yarn publish dist/clr-angular --registry http://localhost:4873; yarn publish dist/clr-icons --registry http://localhost:4873",
"publish:copyversion": "node scripts/copy-version",
"publish:latest": "yarn publish dist/core; yarn publish dist/clr-ui; yarn publish dist/clr-angular; yarn publish dist/clr-icons",
"publish:next": "yarn publish dist/core --tag next; yarn publish dist/clr-ui --tag next; yarn publish dist/clr-angular --tag next; yarn publish dist/clr-icons --tag next",
"publish:rc": "yarn publish dist/core --tag rc; yarn publish dist/clr-ui --tag rc; yarn publish dist/clr-angular --tag rc; yarn publish dist/clr-icons --tag rc",
"publish:local": "yarn publish dist/core --registry http://localhost:4873 --tag local; yarn publish dist/clr-ui --registry http://localhost:4873 --tag local; yarn publish dist/clr-angular --registry http://localhost:4873 --tag local; yarn publish dist/clr-icons --registry http://localhost:4873 --tag local",
"publish:local:npm": "npm publish dist/core --registry http://localhost:4873 --tag local; npm publish dist/clr-ui --registry http://localhost:4873 --tag local; npm publish dist/clr-angular --registry http://localhost:4873 --tag local; npm publish dist/clr-icons --registry http://localhost:4873 --tag local",
"angular:build": "yarn --cwd packages/angular run build",
"angular:test": "yarn --cwd packages/angular run test",
"angular:test:watch": "yarn --cwd packages/angular run test:watch",
Expand Down
67 changes: 45 additions & 22 deletions packages/angular/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
module.exports = {
extends: '../../.eslintrc.js',
// Only adding rules that override the defaults or enforce new standards
rules: {
'@typescript-eslint/no-explicit-any': 'off', // Would LOVE to turn this on
'@typescript-eslint/explicit-function-return-type': 'off', // TOO MUCH WORK AT THE MOMENT
'@typescript-eslint/no-use-before-define': 'off', // Lots of complaints in tests.
'@typescript-eslint/no-unused-vars': 'off', // TypeScript is catching this
'@typescript-eslint/no-var-requires': 'off', // Using raw-loader in Storybook
'@typescript-eslint/ban-ts-ignore': 'off', // There are some quirks where we do want to use ts-ignore, but should be rare
'clarity/no-barrel-imports': 'error', // Custom check to ensure we only import directly from files
'jasmine/no-focused-tests': 'error', // Prevent focused tests
'no-irregular-whitespace': ['error', { skipTemplates: true }], // Turn of whitespace checking inside of `` templates
'no-prototype-builtins': 'off',
},
overrides: [
{
files: ['*.stories.ts'],
rules: {
'@typescript-eslint/no-var-requires': 1,
},
const OFF = 0;
const WARN = 1;
const ERROR = 2;

const bannedTSTypes = {
Array: 'Use [] instead.',
Object: 'Use {} instead.',
Boolean: 'Use `boolean` instead.',
Number: 'Use `number` instead.',
String: 'Use `string` instead.',
};

const rules = {
'@typescript-eslint/no-explicit-any': OFF, // Would LOVE to turn this on
'@typescript-eslint/explicit-function-return-type': OFF, // TOO MUCH WORK AT THE MOMENT
'@typescript-eslint/no-use-before-define': OFF, // Lots of complaints in tests.
'@typescript-eslint/no-unused-vars': OFF, // TypeScript is catching this
'@typescript-eslint/no-var-requires': OFF, // Using raw-loader in Storybook
'@typescript-eslint/ban-ts-ignore': OFF, // There are some quirks where we do want to use ts-ignore, but should be rare
'clarity/no-barrel-imports': ERROR, // Custom check to ensure we only import directly from files
'jasmine/no-focused-tests': ERROR, // Prevent focused tests
'no-irregular-whitespace': [ERROR, { skipTemplates: true }], // Turn of whitespace checking inside of `` templates
'no-prototype-builtins': OFF,
};
const overrides = [
{
files: ['*.stories.ts'],
rules: {
'@typescript-eslint/no-var-requires': 1,
},
],
},
];

const parserOptions = {
project: 'tsconfig.eslint.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
};

const config = {
extends: '../../.eslintrc.js',
parserOptions,
rules,
overrides,
};

module.exports = config;
4 changes: 2 additions & 2 deletions packages/angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "npm",
"analytics": "c06411aa-0b6f-4931-a33f-6405a625e29c"
"packageManager": "yarn",
"analytics": false
},
"newProjectRoot": "projects",
"projects": {
Expand Down
66 changes: 34 additions & 32 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
{
"name": "angular",
"private": true,
"version": "4.0.0-test.1",
"version": "4.0.0-next.0",
"scripts": {
"start": "ng build clr-angular-dev --watch",
"start:dev": "ng build clr-angular-dev --watch --prod",
"start:storybook": "stmux -w always -e ERROR -m beep,system [ \"yarn start:dev\" : \"sleep 25 && yarn storybook\" : \"yarn watch:scss\" ]",
"serve": "ng serve dev",
"serve:dark": "ng serve dev -c dark",
"postinstall": "ngcc --create-ivy-entry-points && node ../../scripts/ngcc-clean",
"build": "npm-run-all build:ng build:package build:golden",
"build": "npm-run-all build:ng build:package",
"build:package": "cpy npm.json README.md ../../dist/clr-angular/; mv ../../dist/clr-angular/npm.json ../../dist/clr-angular/package.json; replace '@VERSION' $npm_package_version ../../dist/clr-angular/package.json",
"build:ng": "ng build clr-angular --prod",
"build:golden": "ts-api-guardian --out ../../dist/golden/clr-angular.d.ts --stripExportPattern '^Çlr' ../../dist/clr-angular/index.d.ts",
"build:ng": "ng build clr-angular",
"build:golden": "ng build clr-angular-dev --prod",
"postbuild:golden": "ts-api-guardian --out ./dist/golden/clr-angular.d.ts --stripExportPattern '^Çlr' ./dist/clr-angular/index.d.ts",
"clean:deps": "shx rm -rf ./dist/clr-icons ./dist/core",
"predev": "ng build clr-angular-dev --prod",
"dev": "ng build dev --prod --progress=false",
"dev:dark": "ng build dev -c dark --prod --progress=false",
"test": "npm-run-all test:unit test:golden",
"test:unit": "ng test clr-angular --watch false --code-coverage",
"test:golden": "diff -u golden/clr-angular.d.ts ../../dist/golden/clr-angular.d.ts",
"pretest:golden": "yarn build:golden",
"test:golden": "diff -u golden/clr-angular.d.ts ./dist/golden/clr-angular.d.ts",
"test:watch": "ng test clr-angular --watch --code-coverage",
"lint": "npm-run-all lint:ts lint:styles",
"lint:ts": "eslint -c .eslintrc.js \"src/**/*.ts\" \"projects/**/*.ts\"",
"lint:styles": "stylelint \"src/**/*.scss\" \"projects/**/*.scss\"",
"lint:fix": "eslint --fix -c .eslintrc.js \"src/**/*.ts\" \"projects/**/*.ts\" && stylelint --fix \"src/**/*.scss\" \"projects/**/*.scss\"",
"pregolden:fix": "yarn build",
"golden:fix": "ts-api-guardian --out golden/clr-angular.d.ts --stripExportPattern '^Çlr' ../../dist/clr-angular/index.d.ts",
"pregolden:fix": "yarn build:golden",
"golden:fix": "ts-api-guardian --out golden/clr-angular.d.ts --stripExportPattern '^Çlr' ./dist/clr-angular/index.d.ts",
"prestorybook": "yarn scss && yarn clean:deps && shx cp -r ../../dist/core ../../dist/clr-icons ./dist",
"storybook": "start-storybook -s .storybook/public -p 6006",
"prebuild-storybook": "yarn scss && yarn clean:deps && shx cp -r ../../dist/core ../../dist/clr-icons ./dist",
Expand All @@ -38,25 +40,25 @@
"scss:optimize": "csso -i ./dist/clr-ui/clr-ui.css -o ./dist/clr-ui/clr-ui.min.css -s file --no-restructure; csso -i ./dist/clr-ui/clr-ui-dark.css -o ./dist/clr-ui/clr-ui-dark.min.css -s file --no-restructure"
},
"dependencies": {
"@angular/animations": "10.0.0-next.6",
"@angular/common": "10.0.0-next.6",
"@angular/compiler": "10.0.0-next.6",
"@angular/core": "10.0.0-next.6",
"@angular/forms": "10.0.0-next.6",
"@angular/platform-browser": "10.0.0-next.6",
"@angular/platform-browser-dynamic": "10.0.0-next.6",
"@angular/router": "10.0.0-next.6",
"@angular/animations": "10.0.0-rc.4",
"@angular/common": "10.0.0-rc.4",
"@angular/compiler": "10.0.0-rc.4",
"@angular/core": "10.0.0-rc.4",
"@angular/forms": "10.0.0-rc.4",
"@angular/platform-browser": "10.0.0-rc.4",
"@angular/platform-browser-dynamic": "10.0.0-rc.4",
"@angular/router": "10.0.0-rc.4",
"css-vars-ponyfill": "2.3.1",
"rxjs": "6.5.4",
"tslib": "1.10.0",
"zone.js": "0.10.2"
"tslib": "^2.0.0",
"zone.js": "0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.1000.0-next.4",
"@angular-devkit/build-ng-packagr": "0.1000.0-next.4",
"@angular/cli": "10.0.0-next.4",
"@angular/compiler-cli": "10.0.0-next.6",
"@angular/language-service": "10.0.0-next.6",
"@angular-devkit/build-angular": "0.1000.0-rc.3",
"@angular-devkit/build-ng-packagr": "0.1000.0-rc.3",
"@angular/cli": "10.0.0-rc.3",
"@angular/compiler-cli": "10.0.0-rc.4",
"@angular/language-service": "10.0.0-rc.4",
"@babel/core": "7.9.6",
"@storybook/addon-actions": "6.0.0-beta.23",
"@storybook/addon-cssresources": "6.0.0-beta.23",
Expand All @@ -80,20 +82,20 @@
"eslint-config-prettier": "6.11.0",
"eslint-plugin-jasmine": "4.1.1",
"jasmine": "3.5.0",
"jasmine-core": "3.4",
"jasmine-core": "~3.5.0",
"jasmine-expect": "4.0.3",
"jasmine-spec-reporter": "4.2.1",
"karma": "4.3.0",
"karma-chrome-launcher": "3.1.0",
"karma-coverage-istanbul-reporter": "2.1.0",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.2",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-mocha-reporter": "2.2.5",
"karma-notify-reporter": "1.2.0",
"karma-parallel": "0.3.1",
"lit-element": "2.3.1",
"lit-html": "1.2.1",
"ng-packagr": "10.0.0-next.0",
"ng-packagr": "^10.0.0-rc.0",
"npm-run-all": "4.1.5",
"postcss-cli": "7.1.0",
"prettier": "2.0.5",
Expand All @@ -104,7 +106,7 @@
"ts-api-guardian": "0.5.0",
"ts-node": "8.3.0",
"tsconfig-paths-webpack-plugin": "3.2.0",
"typescript": "3.8.3"
"typescript": "3.9.5"
},
"browserslist": [
"> 0.5%",
Expand All @@ -119,4 +121,4 @@
"autoprefixer": {}
}
}
}
}
5 changes: 2 additions & 3 deletions packages/angular/projects/clr-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"name": "@clr/angular",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^9.0.7",
"@angular/core": "^9.0.7",
"tslib": "^1.10.0"
"@angular/common": "^10.0.0-rc.4",
"@angular/core": "^10.0.0-rc.4"
}
}
5 changes: 5 additions & 0 deletions packages/angular/tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": { "strict": true },
"include": ["**/*.ts"],
"exclude": ["dist", "node_modules"]
}
2 changes: 1 addition & 1 deletion packages/angular/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"downlevelIteration": true,
"experimentalDecorators": true,
"importHelpers": true,
"module": "esnext",
"module": "es2020",
"moduleResolution": "node",
"target": "es2017",
"lib": ["es2018", "dom"],
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "core",
"private": true,
"version": "4.0.0-test.1",
"version": "4.0.0-next.0",
"scripts": {
"start": "npm-run-all build -p build:watch storybook",
"storybook": "start-storybook -s .storybook/public -p 6006 --config-dir=.storybook",
Expand Down Expand Up @@ -113,4 +113,4 @@
"bugs": {
"url": "https://github.com/vmware/clarity/issues"
}
}
}
4 changes: 2 additions & 2 deletions packages/icons/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "icons",
"private": true,
"version": "4.0.0-test.1",
"version": "4.0.0-next.0",
"scripts": {
"build": "npm-run-all build:css build:optimize build:web build:package",
"build:web": "webpack --config webpack.config.js",
Expand Down Expand Up @@ -35,4 +35,4 @@
"webpack": "4.42.1",
"webpack-cli": "3.3.1"
}
}
}
23 changes: 9 additions & 14 deletions packages/schematics/src/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ function getVersion(ngVersion: string, clrVersion: string) {
const version1 = Number.parseInt(ngVersion.split('.')[0].replace(/\D/g, ''));
const version2 = Number.parseInt(clrVersion.split('.')[0].replace(/\D/g, ''));

if (version1 - version2 > diff) {
// If Angular is more than 6 versions ahead, use `next` tag
return 'next';
} else {
// Else, calculate correct Clarity version by subtracting 6 from Angular major
if (version1 - version2 < diff) {
// If Angular is less than 6 versions ahead, backtrack Clarity version
return `^${version1 - diff}.0.0`;
} else {
// Otherwise, just link to installed version for latest or next releases
return clrVersion;
}
}

Expand Down Expand Up @@ -141,15 +141,10 @@ export default function (options: ComponentOptions): Rule {
const version = getVersion(json.dependencies['@angular/core'], corePackage.version);

const packages = Object.keys(json.dependencies);
if (!packages.includes('@clr/angular')) {
json.dependencies['@clr/angular'] = `${version}`;
}
if (!packages.includes('@clr/ui')) {
json.dependencies['@clr/ui'] = `${version}`;
}
if (!packages.includes('@clr/icons')) {
json.dependencies['@clr/icons'] = `${version}`;
}
json.dependencies['@clr/angular'] = `${version}`;
json.dependencies['@clr/ui'] = `${version}`;
json.dependencies['@clr/icons'] = `${version}`;

if (!packages.includes('@webcomponents/webcomponentsjs')) {
json.dependencies['@webcomponents/webcomponentsjs'] = '^2.0.0';
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ui",
"private": true,
"version": "4.0.0-test.1",
"version": "4.0.0-next.0",
"scripts": {
"build": "npm-run-all build:css build:prefix build:src build:optimize build:package",
"build:css": "sass --precision=8 src/main.scss ../../dist/clr-ui/clr-ui.css; sass --precision=8 src/dark-theme.scss ../../dist/clr-ui/clr-ui-dark.css",
Expand All @@ -19,4 +19,4 @@
"sass": "^1.26.3",
"stylelint": "^13.3.2"
}
}
}
Loading

0 comments on commit a43f782

Please sign in to comment.