Skip to content

Commit

Permalink
refactor: replace yarn with npm (#1405)
Browse files Browse the repository at this point in the history
* refactor: replace yarn with npm

* revert npm requirement back to 14 for vercel

* disable build Storybook job

* fix linting errors

* update lock file

* rebase master and bump encodable/color to 1.1.1

* update package-lock.json

update lock file

* change node version format to satisfy vercel

* remove restriction on @encodable/color

* rename yarn.lock to package-lock.json

* add resolved in lock file and restriction on @encodable/color

* install dependences by npm ci

Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
  • Loading branch information
zhaoyongjie and villebro committed Nov 26, 2021
1 parent 2e5d7d2 commit f552aba
Show file tree
Hide file tree
Showing 56 changed files with 92,179 additions and 24,445 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@ jobs:
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn
- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm
uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-npm-
- name: Install dependencies
run: yarn install --frozen-lockfile
run: npm ci
- name: Build packages
run: yarn build
run: npm run build
- name: Run ESLint
run: yarn lint --quiet
run: npm run lint --quiet
- name: Run unit tests
run: yarn test
run: npm run test
- name: Build Storybook
run: yarn build-storybook
run: npm run build-storybook
- uses: actions/upload-artifact@v2
with:
name: storybookBuild
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ $PWD/coverage.xml"
-or -name .venvs \
-or -name .virtualenv \
-or -name .virtualenvs \
-or -name .yarn-cache \
-or -name .npm-cache \
-or -name __pycache__ \
-or -name env \
-or -name envs \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,28 @@ jobs:
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn
- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm
uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-npm-
- name: Install dependencies
run: yarn install --frozen-lockfile
run: npm ci
- name: Build packages
run: yarn build
run: npm run build
- name: Run unit tests
run: yarn test
run: npm run test

- name: Configure npm and git
run: |
yarn logout
npm logout
echo "@superset-ui:registry=https://registry.npmjs.org/" > .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> $HOME/.npmrc 2> /dev/null
Expand All @@ -77,7 +77,7 @@ jobs:
run: |
git update-index --assume-unchanged .npmrc
git tag -d `git tag | grep -E '^trigger-'`
yarn ci:release-from-tag
npm run ci:release-from-tag
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 3 additions & 7 deletions superset-frontend/temporary_superset_ui/superset-ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,9 @@ test-changelog.md

*.tsbuildinfo

# Ignore npm lock files, always use yarn.lock instead
npm-shrinkwrap.json
package-lock.json

# Ignore yarn.lock in packages
plugins/*/yarn.lock
packages/*/yarn.lock
# Ignore package-lock in packages
plugins/*/package-lock.json
packages/*/package-lock.json

# For country map geojson conversion script
.ipynb_checkpoints/
Expand Down
1 change: 0 additions & 1 deletion superset-frontend/temporary_superset_ui/superset-ui/.npmrc

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"bracketSameLine": false,
"printWidth": 100,
"proseWrap": "always",
"requirePragma": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
### Setup local development

1. clone this repo
2. have `yarn` install package dependencies and manage the symlinking between packages for you
2. have `npm` install package dependencies and manage the symlinking between packages for you

```sh
git clone ...superset-ui && cd superset-ui
yarn install
yarn build
npm ci
npm build
```

To build only selected packages or plugins,

```bash
yarn build "*chart-table"
npm build "*chart-table"
```

### File organization

[lerna](https://github.com/lerna/lerna/) and [yarn](https://yarnpkg.com) are used to manage versions
and dependencies between packages in this monorepo.
[lerna](https://github.com/lerna/lerna/) and [npm](https://www.npmjs.com/) are used to manage
versions and dependencies between packages in this monorepo.

```
superset-ui/
Expand All @@ -44,7 +44,7 @@ superset-ui/
### Builds, linting, and testing

Each package defines its own build config, linting, and testing. You can have lerna run commands
across all packages using the syntax `yarn run test` (or `yarn run test:watch` for watch mode) from
across all packages using the syntax `npm run test` (or `npm run test:watch` for watch mode) from
the root `@superset-ui` directory.

- [Using Storybook](docs/storybook.md) - You can test your components independently from Superset
Expand All @@ -65,7 +65,7 @@ committing. You can use `npm run commit` to help you create a commit message.
publish new versions of `superset-ui`.

1. Checkout the `master` branch from the main repo at `apache-superset/superset-ui` - NOT A FORK!
2. run `yarn run ci:create-patch-version` to bump the patch version (the most common case) or
`yarn run ci:create-minor-version` to bump the minor version. Once the process finishes and the
2. run `npm run ci:create-patch-version` to bump the patch version (the most common case) or
`npm run ci:create-minor-version` to bump the minor version. Once the process finishes and the
commit has been pushed to GitHub, CI will complete publishing the release to npm (takes some time
to complete).
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Activate plugins for local development

1. First, make sure you have run `yarn` and `yarn build` in `superset-ui` or your own plugin repo.
1. First, make sure you have run `npm ci` and `npm run build` in `superset-ui` or your own plugin
repo.
2. Go to [superset-frontend](https://github.com/apache/superset/tree/master/superset-frontend), use
`npm link` to create a symlink of the plugin source code in `node_modules`:

Expand All @@ -23,4 +24,4 @@

## Deactivate plugins

To deactivate a plugin, simply run `npm install` in `superset/superset-frontend` again.
To deactivate a plugin, simply run `npm ci` in `superset/superset-frontend` again.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
You can demo your changes by running the storybook demo locally with the following commands:

```sh
yarn install
yarn build
yarn storybook
npm ci
npm run build
npm run storybook
```

The Storybook will
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "3.2.1",
"npmClient": "yarn",
"npmClient": "npm",
"packages": [
"packages/*",
"plugins/*"
Expand Down
Loading

0 comments on commit f552aba

Please sign in to comment.