Skip to content

Commit

Permalink
chore: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
deleonio committed Sep 13, 2023
1 parent 23194f8 commit d3510ca
Show file tree
Hide file tree
Showing 20 changed files with 396 additions and 184 deletions.
85 changes: 73 additions & 12 deletions .github/workflows/publish-to-npmjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,70 +20,131 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
# - uses: actions/checkout@v3
# - name: Set up Node.js
# uses: actions/setup-node@v3
# with:
# node-version: '14.x'
# registry-url: '${{env.registry}}'
# scope: '@${{env.alias}}'

- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

# - uses: pnpm/action-setup@v2.2.4
# with:
# run_install: false
# version: 7
# - uses: actions/setup-node@v3
# with:
# cache: pnpm
# node-version: 16

# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '14.x'
# cache: pnpm
node-version: 18
registry-url: '${{env.registry}}'
scope: '@${{env.alias}}'
- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store
restore-keys: |
${{ runner.os }}-pnpm-store
- name: Install and publish non @${{env.alias}}/cli, @${{env.alias}}/cli-core-babel, @${{env.alias}}/lib, @${{env.alias}}/stack, @${{env.alias}}/stack-snowpack, @${{env.alias}}/stack-vite and @${{env.alias}}/stack-webpack
run: |
rm -rf packages/stack/core/dist packages/stack/webpack/dist
pnpm i --no-frozen-lockfile
pnpm -r build
npx lerna exec --ignore=@template/* --ignore @${{env.alias}}/cli --ignore @${{env.alias}}/cli-core-babel --ignore @${{env.alias}}/lib --ignore @${{env.alias}}/stack --ignore @${{env.alias}}/stack-snowpack --ignore @${{env.alias}}/stack-vite --ignore @${{env.alias}}/stack-webpack --no-bail --stream -- npm publish --access=${{env.access}} --tag=${{env.tag}} || true
env:
NODE_AUTH_TOKEN: ${{env.token}}

- name: Install and publish only @${{env.alias}}/stack
run: |
npm install
npm i
npm publish --access=${{env.access}} --tag=${{env.tag}} || true
working-directory: packages/stack/core
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/stack-snowpack
continue-on-error: true
run: |
npm install
npm i
npm publish --access=${{env.access}} --tag=${{env.tag}} || true
working-directory: packages/stack/snowpack
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/stack-vite
continue-on-error: true
run: |
npm install
npm i
npm publish --access=${{env.access}} --tag=${{env.tag}} || true
working-directory: packages/stack/vite
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/stack-webpack
continue-on-error: true
run: |
npm install
npm i
npm publish --access=${{env.access}} --tag=${{env.tag}} || true
working-directory: packages/stack/webpack
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/lib
continue-on-error: true
run: |
npm install
npm i
npm publish --access=${{env.access}} --tag=${{env.tag}} || true
working-directory: packages/lib
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/cli-core-babel
continue-on-error: true
run: |
npm install
npm i
npm publish --access=${{env.access}} --tag=${{env.tag}} || true
working-directory: packages/cli/core/babel
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish only @${{env.alias}}/cli
continue-on-error: true
run: |
npm install
npm i
npm publish --access=${{env.access}} --access=public --tag=${{env.tag}} || true
working-directory: packages/cli/core
env:
NODE_AUTH_TOKEN: ${{env.token}}
- name: Install and publish non @${{env.alias}}/cli, @${{env.alias}}/cli-core-babel, @${{env.alias}}/lib, @${{env.alias}}/stack, @${{env.alias}}/stack-snowpack, @${{env.alias}}/stack-vite and @${{env.alias}}/stack-webpack
continue-on-error: true
run: |
rm -rf packages/stack/core/dist packages/stack/webpack/dist
npx lerna exec --ignore @template/* --ignore @${{env.alias}}/cli --ignore @${{env.alias}}/cli-core-babel --ignore @${{env.alias}}/lib --ignore @${{env.alias}}/stack --ignore @${{env.alias}}/stack-snowpack --ignore @${{env.alias}}/stack-vite --ignore @${{env.alias}}/stack-webpack --stream -- npm install
npx lerna exec --ignore @template/* --ignore @${{env.alias}}/cli --ignore @${{env.alias}}/cli-core-babel --ignore @${{env.alias}}/lib --ignore @${{env.alias}}/stack --ignore @${{env.alias}}/stack-snowpack --ignore @${{env.alias}}/stack-vite --ignore @${{env.alias}}/stack-webpack --no-bail --stream -- npm publish --access=${{env.access}} --tag=${{env.tag}} || true
pnpm --filter !packages/cli/core --filter !packages/cli/core/babel --filter !packages/lib --filter !packages/stack --filter !packages/stack/snowpack --filter !packages/stack/vite --filter !packages/stack/webpack --parallel --recursive exec npm i
pnpm --filter !packages/cli/core --filter !packages/cli/core/babel --filter !packages/lib --filter !packages/stack --filter !packages/stack/snowpack --filter !packages/stack/vite --filter !packages/stack/webpack --parallel --recursive exec npm publish --access=${{env.access}} --tag=${{env.tag}} || true
# npx lerna exec --ignore @template/* --ignore @${{env.alias}}/cli --ignore @${{env.alias}}/cli-core-babel --ignore @${{env.alias}}/lib --ignore @${{env.alias}}/stack --ignore @${{env.alias}}/stack-snowpack --ignore @${{env.alias}}/stack-vite --ignore @${{env.alias}}/stack-webpack --stream -- npm i
# npx lerna exec --ignore @template/* --ignore @${{env.alias}}/cli --ignore @${{env.alias}}/cli-core-babel --ignore @${{env.alias}}/lib --ignore @${{env.alias}}/stack --ignore @${{env.alias}}/stack-snowpack --ignore @${{env.alias}}/stack-vite --ignore @${{env.alias}}/stack-webpack --no-bail --stream -- npm publish --access=${{env.access}} --tag=${{env.tag}} || true
env:
NODE_AUTH_TOKEN: ${{env.token}}

- name: Test all framework variants
continue-on-error: true
run: |
rm ../.eslintrc.js
sh wake-up-all.sh ${{env.alias}} ${{env.tag}}
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"scripts": {
"ci": "npm ci && lerna exec --ignore=@template/* --stream -- npm ci",
"format:tpl": "prettier --write packages/cli/frameworks/*/template/src/**/* --ignore-unknown",
"ncu": "npm run ncu:patch && npm run ncu:minor && npm run ncu:major",
"ncu": "pnpm ncu:patch && pnpm ncu:minor && pnpm ncu:major",
"ncu:minor": "ncu -t minor -u && pnpm -r exec ncu -t minor -u -x @leanup/*,typescript",
"ncu:patch": "ncu -t patch -u && pnpm -r exec ncu -t patch -u",
"ncu:major": "ncu && pnpm -r exec ncu",
"pack": "lerna exec --ignore=@template/* --stream -- npm install && lerna exec --ignore=@template/* --stream -- npm pack",
"outdated": "(npm outdated || true) && pnpm -r exec npm outdated",
"remove": "pnpm -r exec rm -rf node_modules package-lock.json *.log *.tgz && rm -rf node_modules package-lock.json *.log *.tgz && git clean -f -d -X",
"reinstall": "npm run remove && npm run update",
"reinstall": "pnpm remove && pnpm update",
"update": "npm install && lerna exec --ignore=@template/* --no-bail --stream -- npm install",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
Expand All @@ -23,7 +23,7 @@
},
"lint-staged": {
"{packages}/**": [
"npm run format:tpl"
"pnpm format:tpl"
]
},
"repository": {
Expand All @@ -48,11 +48,11 @@
"husky": "8.0.3",
"lerna": "7.2.0",
"lint-staged": "14.0.1",
"npm-check-updates": "16.13.3",
"npm-check-updates": "16.14.0",
"prettier": "3.0.3",
"prettier-plugin-svelte": "3.0.3",
"svelte": "3.59.2",
"typescript": "5.2.2",
"vitepress": "1.0.0-rc.12"
"vitepress": "1.0.0-rc.13"
}
}
2 changes: 1 addition & 1 deletion packages/cli/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"chalk": "4.1.2",
"commander": "9.5.0",
"deepmerge": "4.3.1",
"prettier": "3.0.3"
"prettier": "2.8.8"
},
"devDependencies": {
"@types/node": "20.6.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/core/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"e2e": "nightwatch",
"format": "prettier --check \"{src,tests}/**\" --ignore-unknown",
"lint": "eslint \"{src,tests}/**/*.{html,js,json,jsx,ts,tsx,gql,graphql}\"",
"reinstall": "npm run remove && npm install",
"reinstall": "pnpm remove && npm install",
"remove": "rm -rf node_modules package-lock.json",
"update": "ncu -t minor -u && npm install && ncu",
"build": "cross-env NODE_ENV=production webpack",
"start": "npm run serve -- --open",
"start": "pnpm serve -- --open",
"serve": "cross-env NODE_ENV=development webpack serve --devtool=source-map --no-hot",
"preview": "vite preview",
"test": "cross-env NODE_ENV=test mocha",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"module": "UMD",
"removeComments": true,
"target": "ES2015",
"types": ["chalk", "commander", "node", "prettier"],
"types": ["node", "prettier"],
"typeRoots": ["node_modules/@types"]
},
"include": ["src/**/*.ts"],
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lup/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"module": "UMD",
"removeComments": true,
"target": "ES2015",
"types": ["chalk", "commander", "node"],
"types": ["node"],
"typeRoots": ["node_modules/@types"]
},
"include": ["src/**/*.ts"],
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/plugins/addons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"devDependencies": {
"@leanup/cli": "1.3.47",
"@types/node": "20.6.0",
"typescript": "5.2.2"
"typescript": "5.2.2",
"webpack": "5.65.0"
},
"peerDependencies": {
"@leanup/cli": "~1.3.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/form/nyc.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
},
sourceMap: false,
instrument: true,
statements: 61,
statements: 60,
branches: 43,
functions: 64,
lines: 61,
Expand Down
7 changes: 4 additions & 3 deletions packages/form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"rollup": "2.79.1",
"rollup-plugin-terser": "7.0.2",
"sinon": "13.0.2",
"tslib": "2.6.2",
"typescript": "5.2.2"
},
"scripts": {
Expand All @@ -51,11 +52,11 @@
"build:types": "tsc -d --outDir types -p tsconfig.build.json && rm -rf types/*.js types/*.map types/**/*.js types/**/*.map",
"build:umd": "rollup -c rollup.config.js",
"build:cleanup": "rm -rf cjs esm types umd",
"build": "npm run build:cleanup && npm run build:cjs && npm run build:esm && npm run build:types && npm run build:umd",
"build": "pnpm build:cleanup && pnpm build:cjs && pnpm build:esm && pnpm build:types && pnpm build:umd",
"test": "npx cross-env NODE_ENV=test nyc --check-coverage mocha",
"prepack": "npm test && npm run build",
"prepack": "npm test && pnpm build",
"remove": "rm -rf node_modules",
"reinstall": "npm run remove && npm run update",
"reinstall": "pnpm remove && pnpm update",
"update": "npm install && npm update && npm outdated"
},
"files": [
Expand Down
7 changes: 3 additions & 4 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-typescript": "8.5.0",
"@types/chai": "4.3.6",
"@types/loglevel": "1.6.3",
"@types/mocha": "9.1.1",
"@types/node": "20.6.0",
"@types/sinon": "10.0.16",
Expand All @@ -56,11 +55,11 @@
"build:types": "tsc -d --outDir types -p tsconfig.build.json && rm -rf types/*.js types/*.map types/**/*.js types/**/*.map",
"build:umd": "rollup -c rollup.config.js",
"build:cleanup": "rm -rf cjs esm types umd",
"build": "npm run build:cleanup && npm run build:cjs && npm run build:esm && npm run build:types && npm run build:umd",
"build": "pnpm build:cleanup && pnpm build:cjs && pnpm build:esm && pnpm build:types && pnpm build:umd",
"test": "npx cross-env NODE_ENV=test nyc --check-coverage mocha",
"prepack": "npm test && npm run build",
"prepack": "npm test && pnpm build",
"remove": "rm -rf node_modules",
"reinstall": "npm run remove && npm run update",
"reinstall": "pnpm remove && pnpm update",
"update": "npm install && npm update && npm outdated"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"skipLibCheck": true,
"removeComments": true,
"target": "ES2015",
"types": ["chai", "loglevel", "mocha", "node", "sinon"],
"types": ["chai", "mocha", "node", "sinon"],
"typeRoots": ["node_modules/@types"]
},
"include": ["src"]
Expand Down
4 changes: 2 additions & 2 deletions packages/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"url": "https://github.com/leanupjs/leanup/issues"
},
"scripts": {
"build": "rm -rf dist typescript-rxjs && npm run generate:typescript-rxjs",
"build": "rm -rf dist typescript-rxjs && pnpm generate:typescript-rxjs",
"generate:typescript-rxjs": "openapi-generator-cli generate -g typescript-rxjs -o typescript-rxjs -i src/openapi.yml",
"create:package-json": "node scripts/create-package-json.js dipa-projekt dipa-openapi 0.0.0 dipa-projekt/dipa-hub",
"add:bearer-handling": "node scripts/add-bearer-handling.js",
"prepack": "npm run build && tsc -p typescript-rxjs && mv typescript-rxjs/dist dist"
"prepack": "pnpm build && tsc -p typescript-rxjs && mv typescript-rxjs/dist dist"
},
"dependencies": {
"rxjs": "7.8.1"
Expand Down
6 changes: 3 additions & 3 deletions packages/stack/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"nightwatch": "2.6.21",
"nyc": "15.1.0",
"postcss": "8.4.29",
"prettier": "3.0.3",
"prettier": "2.8.8",
"sass": "1.66.1",
"sinon": "13.0.2",
"tslib": "2.6.2"
Expand All @@ -107,7 +107,7 @@
"build:mjs": "tsc --outDir dist/mjs -p tsconfig.mjs.json && node ../../../scripts/package.js dist/mjs module",
"build:rm": "rm -rf dist",
"build:types": "tsc -d --outDir dist/types -p tsconfig.mjs.json && rm -rf dist/types/*.{js,map} dist/types/**/*.{js,map}",
"build": "npm run build:rm && npm run build:cjs && npm run build:mjs && npm run build:types",
"prepack": "npm run build"
"build": "pnpm build:rm && pnpm build:cjs && pnpm build:mjs && pnpm build:types",
"prepack": "pnpm build"
}
}
8 changes: 7 additions & 1 deletion packages/stack/core/src/cjs/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const fs = require('fs');
const path = require('path');

export let PROXIES: Object = {};
Expand All @@ -8,7 +9,12 @@ try {
}

const packageJsonApp = require(path.resolve(process.cwd(), 'package.json'));
const packageJsonCli = require(path.resolve(process.cwd(), 'node_modules/@leanup/stack/package.json'));
let packageJsonCli;
try {
packageJsonCli = JSON.parse(fs.readFileSync(require.resolve('@leanup/stack/package.json'), 'utf-8'));
} catch (error) {
packageJsonCli = {};
}

let proxyConfig;
try {
Expand Down
10 changes: 7 additions & 3 deletions packages/stack/core/src/mjs/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import fs from 'fs';
import path from 'path';
import { createRequire } from 'module';

const require = createRequire(import.meta.url);

export let PROXIES: Object = {};
try {
PROXIES = require(path.resolve(process.cwd(), 'proxy.conf.json'));
Expand All @@ -11,7 +10,12 @@ try {
}

const packageJsonApp = require(path.resolve(process.cwd(), 'package.json'));
const packageJsonCli = require(path.resolve(process.cwd(), 'node_modules/@leanup/stack/package.json'));
let packageJsonCli;
try {
packageJsonCli = JSON.parse(fs.readFileSync(require.resolve('@leanup/stack/package.json'), 'utf-8'));
} catch (error) {
packageJsonCli = {};
}

let proxyConfig;
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/stack/frameworks/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"build:mjs": "tsc --outDir dist/mjs -p tsconfig.mjs.json && node ../../../../scripts/package.js dist/mjs module",
"build:rm": "rm -rf dist",
"build:types": "tsc -d --outDir dist/types -p tsconfig.mjs.json && rm -rf dist/types/*.{js,map} dist/types/**/*.{js,map}",
"build": "npm run build:rm && npm run build:cjs && npm run build:mjs && npm run build:types",
"prepack": "npm run build"
"build": "pnpm build:rm && pnpm build:cjs && pnpm build:mjs && pnpm build:types",
"prepack": "pnpm build"
}
}
2 changes: 2 additions & 0 deletions packages/stack/frameworks/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"devDependencies": {
"@leanup/stack-webpack": "1.3.47",
"@types/node": "20.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.2.2"
},
"peerDependencies": {
Expand Down
Loading

0 comments on commit d3510ca

Please sign in to comment.