Skip to content

Commit

Permalink
build: Use NPM Workspace instead of Lerna to bootstrap (#1142)
Browse files Browse the repository at this point in the history
* build: use NPM workspace instead of Lerna

* fix: workaround npm's lack of topological oder

Basically, npm would run `prepare` on each packages in alphabetical order but components need design to be built first.

This works around that limitation by firing the scripts manually through `npm run [script] -w` which respects the order under `workspaces`

npm/rfcs#548

* fix: reorder scripts for my own sanity

* build: update circle to not look for lock files

* build: use node 18 image on circle ci

* fix: js and css linters

* build: use -omit=optional

* fix: update time test work on node 18

* fix: don't update snaps

* fix: update some snaps

* build: make storybook run on node 18

Thanks @rodrigoeidelvein for the workaround!

* fix: reinstall ts-node

* chore: use lerna recommended setting for symlink

* fix: refix storybook by using js file

* fix: match * on preventManualRelease check
  • Loading branch information
Darryl Tec authored Mar 24, 2023
1 parent eb99b40 commit 76337c4
Show file tree
Hide file tree
Showing 24 changed files with 17,047 additions and 37,853 deletions.
16 changes: 2 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ orbs:
references:
container_config: &container_config
docker:
- image: circleci/node:14
- image: cimg/node:18.15.0
working_directory: ~/atlantis

restore_repo: &restore_repo
Expand All @@ -19,16 +19,10 @@ references:
- v1-repo-{{ .Branch }}
- v1-repo

sum_lockfiles: &sum_lockfiles
run:
name: Sum Lockfiles
command: md5sum package-lock.json packages/*/package-lock.json > /tmp/lock-sums

restore_npm_cache: &restore_npm_cache
restore_cache:
name: Restore npm cache
keys:
- npm-cache-v1-{{ arch }}-{{ checksum "/tmp/lock-sums" }}
- npm-cache-v1

attach_workspace: &attach_workspace
Expand All @@ -44,7 +38,7 @@ references:
npm_install: &npm_install
run:
name: Install Dependencies
command: export IGNORE_OPTIONAL_DEPENDENCIES=true; npm ci --no-optional --legacy-peer-deps
command: export IGNORE_OPTIONAL_DEPENDENCIES=true; npm ci -omit=optional --legacy-peer-deps

github_authenticity: &github_authenticity
run:
Expand Down Expand Up @@ -74,18 +68,12 @@ jobs:
<<: *container_config
steps:
- *attach_workspace
- *sum_lockfiles
- *restore_npm_cache
- run:
name: Authenticate with npm
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/atlantis/.npmrc
- *npm_install
- *persist_to_workspace
- save_cache:
name: Save npm cache
key: npm-cache-v1-{{ arch }}-{{ checksum "/tmp/lock-sums" }}
paths:
- ~/.npm

check_for_manual_release:
<<: *container_config
Expand Down
10 changes: 4 additions & 6 deletions .storybook/main.ts → .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { StorybookConfig } from "@storybook/react/types";
import * as webpack from "webpack";
const path = require("path");

const config: StorybookConfig = {
const config = {
stories: [
"../packages/**/*.stories.mdx",
"../packages/**/*.stories.@(js|jsx|ts|tsx)",
Expand All @@ -26,7 +24,7 @@ const config: StorybookConfig = {
* Separate existing rules for CSS files
*/
if (config.module?.rules) {
const matcher = (rule: webpack.RuleSetRule): boolean =>
const matcher = (rule) =>
rule.test?.toString() === "/\\.css$/";
const existingRule = config.module.rules.find(matcher);

Expand All @@ -37,15 +35,15 @@ const config: StorybookConfig = {
const atlantisCssRule = {
...existingRule,
exclude: /node_modules/,
use: (existingRule?.use as webpack.RuleSetLoader[])?.map(item => {
use: existingRule?.use?.map(item => {
let newItem = item;
if (newItem.loader?.includes("/css-loader/")) {
const modules = {
localIdentName: "[name]__[local]--[hash:base64:5]",
};
newItem = {
...newItem,
options: { ...(newItem.options as Record<any, any>), modules },
options: { ...newItem.options, modules },
};
}
return newItem;
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module.exports = {
moduleNameMapper: {
"\\.css$": "identity-obj-proxy",
"react-markdown":
"<rootDir>/packages/components/node_modules/react-markdown/react-markdown.min.js",
"<rootDir>/node_modules/react-markdown/react-markdown.min.js",
},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
Expand Down
11 changes: 8 additions & 3 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"version": "independent",
"packages": ["packages/*"],
"packages": [
"packages/*"
],
"command": {
"version": {
"conventionalCommits": true,
"message": "chore(release): Publish",
"allowBranch": ["master"]
"allowBranch": [
"master"
]
},
"publish": {
"ignoreChanges": [
Expand All @@ -15,5 +19,6 @@
"CHANGELOG.md"
]
}
}
},
"useWorkspaces": true
}
Loading

0 comments on commit 76337c4

Please sign in to comment.