Skip to content

Commit

Permalink
chore(dist): simplify release process
Browse files Browse the repository at this point in the history
  • Loading branch information
bigopon committed Jul 8, 2021
1 parent c358658 commit 42e496d
Show file tree
Hide file tree
Showing 23 changed files with 260 additions and 71 deletions.
85 changes: 42 additions & 43 deletions .circleci/config.yml
Expand Up @@ -281,7 +281,6 @@ jobs:
steps:
- run: git checkout << parameters.branch >>
- run: git pull
- run: sudo npm i -g ts-node @types/node
- run:
name: "Authenticate with registry"
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
Expand Down Expand Up @@ -404,20 +403,20 @@ workflows:
# Triggered by push to master or topic branches
build_test:
jobs:
# - unit_test_esm:
# <<: *filter_ignore_develop_release
# name: unit_test_esm_chrome
# npm_command: "test-chrome"
# - unit_test_esm:
# <<: *filter_ignore_develop_release
# name: unit_test_esm_firefox
# npm_command: "test-firefox"
# coverage: false
# - unit_test_esm:
# <<: *filter_ignore_develop_release
# name: unit_test_esm_node
# npm_command: "test-node"
# coverage: false
- unit_test_esm:
<<: *filter_ignore_develop_release
name: unit_test_esm_chrome
npm_command: "test-chrome"
- unit_test_esm:
<<: *filter_ignore_develop_release
name: unit_test_esm_firefox
npm_command: "test-firefox"
coverage: false
- unit_test_esm:
<<: *filter_ignore_develop_release
name: unit_test_esm_node
npm_command: "test-node"
coverage: false
- unit_test_cjs:
<<: *filter_ignore_develop_release
npm_command: "test-node"
Expand All @@ -427,34 +426,34 @@ workflows:
# npm_command: "test-262"
# coverage: false
# submodules: true
# - lint_packages:
# <<: *filter_ignore_develop_release
# - benchmark_playwright:
# <<: *filter_ignore_develop_release
# - e2e_playwright:
# <<: *filter_ignore_develop_release
# name: jit-webpack-conventions-ts
# path: "examples/jit-webpack-conventions-ts"
# requires:
# - lint_packages # not a real requirement but forces long-running jobs to go first
# - e2e_playwright:
# <<: *filter_ignore_develop_release
# name: jit-webpack-vanilla-ts
# path: "examples/jit-webpack-vanilla-ts"
# requires:
# - lint_packages # not a real requirement but forces long-running jobs to go first
- lint_packages:
<<: *filter_ignore_develop_release
- benchmark_playwright:
<<: *filter_ignore_develop_release
- e2e_playwright:
<<: *filter_ignore_develop_release
name: jit-webpack-conventions-ts
path: "examples/jit-webpack-conventions-ts"
requires:
- lint_packages # not a real requirement but forces long-running jobs to go first
- e2e_playwright:
<<: *filter_ignore_develop_release
name: jit-webpack-vanilla-ts
path: "examples/jit-webpack-vanilla-ts"
requires:
- lint_packages # not a real requirement but forces long-running jobs to go first
- merge_and_dist:
<<: *filter_only_master
name: merge_and_dist_master
requires:
# - unit_test_esm_chrome
# - unit_test_esm_firefox
# - unit_test_esm_node
- unit_test_esm_chrome
- unit_test_esm_firefox
- unit_test_esm_node
- unit_test_cjs
#- test_test262
# - lint_packages
# - jit-webpack-conventions-ts
# - jit-webpack-vanilla-ts
- lint_packages
- jit-webpack-conventions-ts
- jit-webpack-vanilla-ts
from: master
to: develop
channel: dev
Expand All @@ -464,13 +463,13 @@ workflows:
<<: *filter_only_topic
name: merge_and_dist_topic
requires:
# - unit_test_esm_chrome
# - unit_test_esm_firefox
# - unit_test_esm_node
- unit_test_esm_chrome
- unit_test_esm_firefox
- unit_test_esm_node
- unit_test_cjs
# - lint_packages
# - jit-webpack-conventions-ts
# - jit-webpack-vanilla-ts
- lint_packages
- jit-webpack-conventions-ts
- jit-webpack-vanilla-ts
from: master
to: develop
channel: dev
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
@@ -1,3 +1,4 @@
dist
node_modules
.eslintrc.cjs
scripts/*.js
2 changes: 1 addition & 1 deletion examples/1kcomponents/package.json
Expand Up @@ -9,7 +9,7 @@
"version": "0.8.0",
"scripts": {
"build": "webpack --config webpack.config.js",
"serve": "node ../../node_modules/@aurelia/http-server/dist/bundle/cli.js au.conf.js"
"serve": "node ../../node_modules/@aurelia/http-server/dist/esm/cli.js au.conf.js"
},
"dependencies": {
"@aurelia/kernel": "2.0.0-alpha.10",
Expand Down
4 changes: 2 additions & 2 deletions examples/doc-example/package.json
Expand Up @@ -35,8 +35,8 @@
"start": "webpack-dev-server",
"build": "rimraf dist && webpack --mode=production",
"watch": "webpack-dev-server",
"serve": "node ./node_modules/@aurelia/http-server/dist/bundle/cli.js au.conf.js",
"build-serve": "rimraf dist && webpack --mode=production && node ./node_modules/@aurelia/http-server/dist/bundle/cli.js au.conf.js",
"serve": "node ./node_modules/@aurelia/http-server/dist/esm/cli.js au.conf.js",
"build-serve": "rimraf dist && webpack --mode=production && node ./node_modules/@aurelia/http-server/dist/esm/cli.js au.conf.js",
"now": "rimraf dist && webpack --config webpack.config.js && cd dist && now && cd .."
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/fractals-tree/package.json
Expand Up @@ -9,7 +9,7 @@
"version": "0.8.0",
"scripts": {
"build": "webpack --config webpack.config.js",
"serve": "node ../../node_modules/@aurelia/http-server/dist/bundle/cli.js au.conf.js"
"serve": "node ../../node_modules/@aurelia/http-server/dist/esm/cli.js au.conf.js"
},
"dependencies": {
"@aurelia/kernel": "2.0.0-alpha.10",
Expand Down
4 changes: 2 additions & 2 deletions examples/navigation-skeleton/package.json
Expand Up @@ -5,8 +5,8 @@
"scripts": {
"watch": "webpack-dev-server",
"build": "rimraf dist && webpack --config webpack.config.js",
"serve": "node ./node_modules/@aurelia/http-server/dist/bundle/cli.js au.conf.js",
"build-serve": "rimraf dist && webpack --config webpack.config.js && node ./node_modules/@aurelia/http-server/dist/bundle/cli.js au.conf.js",
"serve": "node ./node_modules/@aurelia/http-server/dist/esm/cli.js au.conf.js",
"build-serve": "rimraf dist && webpack --config webpack.config.js && node ./node_modules/@aurelia/http-server/dist/esm/cli.js au.conf.js",
"now": "rimraf dist && webpack --config webpack.config.js && cd dist && now && cd .."
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/rainbow-spiral/package.json
Expand Up @@ -9,7 +9,7 @@
"version": "0.8.0",
"scripts": {
"build": "webpack --config webpack.config.js",
"serve": "node ../../node_modules/@aurelia/http-server/dist/bundle/cli.js au.conf.js"
"serve": "node ../../node_modules/@aurelia/http-server/dist/esm/cli.js au.conf.js"
},
"dependencies": {
"@aurelia/kernel": "2.0.0-alpha.10",
Expand Down
2 changes: 1 addition & 1 deletion examples/sierpinski-triangle/package.json
Expand Up @@ -9,7 +9,7 @@
"version": "0.8.0",
"scripts": {
"build": "webpack --config webpack.config.js",
"serve": "node ../../node_modules/@aurelia/http-server/dist/bundle/cli.js au.conf.js"
"serve": "node ../../node_modules/@aurelia/http-server/dist/esm/cli.js au.conf.js"
},
"dependencies": {
"@aurelia/kernel": "2.0.0-alpha.10",
Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -61,6 +61,7 @@
"build:release": "lage run build --scope aurelia --scope au --scope @aurelia/a* --scope @aurelia/b* --scope @aurelia/f* --scope @aurelia/h* --scope @aurelia/i* --scope @aurelia/k* --scope @aurelia/m* --scope @aurelia/p* --scope @aurelia/r* --scope @aurelia/s* --scope @aurelia/t* --scope @aurelia/v* --scope @aurelia/w* --no-cache --verbose --no-deps",
"postbuild:release": "npm run clean:tsconfig-build-cache",
"build:release:full": "npm run build:release && npm run change-tsconfigs:invert && npm run build:release && npm run change-tsconfigs:restore",
"build:release-script": "tsc --project scripts/tsconfig.release-script.json",
"change-package-refs:dev": "ts-node -P tsconfig.json scripts/change-package-refs.ts dev",
"change-package-refs:release": "ts-node -P tsconfig.json scripts/change-package-refs.ts release",
"clean": "rimraf dist packages/*/dist packages-cjs/*/dist test/*/dist test/benchmarking-apps/*/dist examples/*/dist",
Expand All @@ -76,8 +77,8 @@
"change-tsconfigs:restore": "ts-node -P tsconfig.json scripts/change-tsconfigs.ts restore",
"prepare-release": "ts-node -P tsconfig.json scripts/prepare-release.ts",
"generate-native-modules": "ts-node -P tsconfig.json scripts/generate-native-modules.ts",
"publish:dev": "ts-node -P tsconfig.json scripts/publish.ts dev --transpile-only",
"publish:latest": "ts-node -P tsconfig.json scripts/publish.ts latest --transpile-only",
"publish:dev": "node scripts/publish.js dev",
"publish:latest": "node scripts/publish.js latest",
"bump-version:dev": "ts-node -P tsconfig.json scripts/bump-version.ts dev",
"bump-version:latest": "ts-node -P tsconfig.json scripts/bump-version.ts latest",
"check-dependencies": "ts-node -P tsconfig.json scripts/check-dependencies.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/http-server/bin/cli.js
@@ -1,4 +1,4 @@
#!/usr/bin/env node
/* eslint-disable import/extensions */

import '../dist/bundle/cli.js';
import '../dist/esm/cli.js';
2 changes: 1 addition & 1 deletion packages/http-server/rollup.config.js
Expand Up @@ -29,7 +29,7 @@ export default [
external: Object.keys(pkg.dependencies).concat('os', 'path', 'fs', 'http', 'https', 'http2', 'url', 'stream'),
output: [
{
file: 'dist/bundle/cli.js',
file: 'dist/esm/cli.js',
format: 'es',
sourcemap: true
},
Expand Down
6 changes: 2 additions & 4 deletions scripts/generate-native-modules.ts
Expand Up @@ -3,12 +3,12 @@
// example:
// import {} from '@aurelia/kernel'
// ->
// import {} from '../../kernel/dist/bundle/index.js'
// import {} from '../../kernel/dist/esm/index.js'
// this works with CDN well, though it wouldn't have the proper sourcemap
// todo: consider make this step part of the rollup build
// ------------------------
import * as ts from 'typescript';
import { File, getFiles } from './files';
import { getFiles } from './files';
import { createLogger } from './logger';
import project from './project';
import * as path from 'path';
Expand All @@ -21,9 +21,7 @@ const log = createLogger('generate-native-modules');

for (const pkg of packages) {
const distPath = path.join(pkg.path, 'dist');
// old bundling code:
const esmPath = path.join(distPath, 'esm');
// const bundlePath = path.join(distPath, 'bundle');
const nativeModulesPath = path.join(distPath, 'native-modules');

log.info(`Processing '${esmPath}'`);
Expand Down
51 changes: 51 additions & 0 deletions scripts/package.json.js
@@ -0,0 +1,51 @@
/* eslint-disable */
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.savePackageJson = exports.loadPackageJson = void 0;
const fs_1 = require("fs");
const path_1 = require("path");
const project_1 = __importDefault(require("./project"));
/**
* Reads and parses the content of a package.json file
*
* @param pathSegments - The path segments of the folder where the package.json is located, relative to the root of the project
*/
async function loadPackageJson(...pathSegments) {
const path = path_1.join(project_1.default.path, ...pathSegments, 'package.json');
return new Promise((resolve, reject) => {
fs_1.readFile(path, (err, data) => {
if (err) {
reject(err);
}
if (!data) {
throw new Error(`Empty file: ${path}`);
}
const str = data.toString('utf8');
const json = JSON.parse(str);
resolve(json);
});
});
}
exports.loadPackageJson = loadPackageJson;
/**
* Stringifies and writes out the content of a package.json file
*
* @param pkg - The package.json as an object
* @param pathSegments - The path segments of the folder where the package.json is located, relative to the root of the project
*/
async function savePackageJson(pkg, ...pathSegments) {
const path = path_1.join(project_1.default.path, ...pathSegments, 'package.json');
return new Promise((resolve, reject) => {
const str = JSON.stringify(pkg, null, 2);
fs_1.writeFile(path, str, { encoding: 'utf8' }, (err) => {
if (err) {
reject(err);
}
resolve();
});
});
}
exports.savePackageJson = savePackageJson;
1 change: 0 additions & 1 deletion scripts/package.json.ts
@@ -1,4 +1,3 @@
// @ts-nocheck
import { readFile, writeFile } from 'fs';
import { join } from 'path';
import project from './project';
Expand Down

0 comments on commit 42e496d

Please sign in to comment.