Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Update loom to v1 #2150

Merged
merged 4 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['12.14', '14.x', '16.x']
node-version: ['12.22', '14.x', '16.x']
timeout-minutes: 15

steps:
Expand Down
27 changes: 18 additions & 9 deletions config/loom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import {
createComposedProjectPlugin,
createProjectTestPlugin,
} from '@shopify/loom';
import {babel} from '@shopify/loom-plugin-babel';
import {packageBuild} from '@shopify/loom-plugin-package-build';
import {buildLibrary, babel} from '@shopify/loom-plugin-build-library';

// Needed so TS realises what configuration hooks are provided by Jest
import type {} from '@shopify/loom-plugin-jest';

export function quiltPackage({
isIsomorphic = true,
jestEnv = 'jsdom',
jestTestRunner = 'jest-circus',
polyfill = true,
Expand All @@ -16,7 +18,19 @@ export function quiltPackage({
// occur we need to turn some options off
const polyfillOptions = polyfill ? {} : {useBuiltIns: false, corejs: false};

const targets = isIsomorphic
? 'extends @shopify/browserslist-config, node 12.14.0'
: 'node 12.14.0';
Comment on lines +22 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node target should be 12.22.9

I wonder if there's a way of having the node version live somewhere, so that both loom config and node-ci.yml always have the same version? 🤔

Copy link
Member Author

@BPScott BPScott Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're retaining 12.14.0 as our minimum supported version, and thus the version we transpile to. (This matches the minimum version for the that we specify we support in the engines field in the various package.jsons).

Increasing this means would mean we are dropping support for some versions of node, which is a breaking change. We want to do that at some point but not right now.


The change in the ci config means say we support 12.14, but only run tests against 12.22, which isn't ideal, but I think that is a better state of affairs than being trapped on an old loom version until we make the breaking change to drop support for node 12, considering we want to make that change kinda soonish.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increasing this means would mean we are dropping support for some versions of node, which is a breaking change. We want to do that at some point but not right now.

Makes sense, I agree that dropping support is out of scope for this PR.

The change in the ci config means say we support 12.14, but only run tests against 12.22, which isn't ideal, but I think that is a better state of affairs than being trapped on an old loom version until we make the breaking change to drop support for node 12

Thanks for clarifying/reiterating the node 12.14 and 12.22 use cases 👍


return createComposedProjectPlugin<Package>('Quilt.Package', [
buildLibrary({
targets,
commonjs: true,
esmodules: true,
esnext: true,
rootEntrypoints: true,
jestTestEnvironment: jestEnv,
}),
babel({
config: {
presets: [
Expand All @@ -27,21 +41,16 @@ export function quiltPackage({
],
},
}),
packageBuild({
nodeTargets: 'node 12.14.0',
browserTargets: 'extends @shopify/browserslist-config',
}),
createProjectTestPlugin('Quilt.PackageTest', ({hooks}) => {
hooks.configure.hook((hooks) => {
hooks.jestEnvironment?.hook(() => jestEnv);
hooks.jestTestRunner?.hook(() => jestTestRunner);

hooks.jestTransforms?.hook((transforms) => ({
hooks.jestTransform?.hook((transforms) => ({
...transforms,
'\\.(gql|graphql)$': 'jest-transform-graphql',
}));

hooks.jestWatchIgnore?.hook((patterns) => [
hooks.jestWatchPathIgnorePatterns?.hook((patterns) => [
...patterns,
'<rootDir>/.*/tests?/.*fixtures',
]);
Expand Down
12 changes: 8 additions & 4 deletions loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import {createWorkspace, createWorkspaceTestPlugin} from '@shopify/loom';
import {
buildLibrary,
buildLibraryWorkspace,
} from '@shopify/loom-plugin-build-library';
import {eslint} from '@shopify/loom-plugin-eslint';
import {jest} from '@shopify/loom-plugin-jest';
import {prettier} from '@shopify/loom-plugin-prettier';
import {workspaceTypeScript} from '@shopify/loom-plugin-typescript';

// Needed so TS realises what configuration hooks are provided by Jest
import type {} from '@shopify/loom-plugin-jest';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious about why it's importing an empty object? Is this intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is intentional, but it is not obvious why.

Loom does some kinda funky things with augmenting objects, that don't quite always work super cleanly.
This is needed so that typescript realises that hooks.jestConfig is a valid key on the hooks object and that it has a particular shape of its own. Without this it thinks that jestConfig is not a valid key.

I'll add a comment explaining this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for elaborating and for adding the comment 🎉


export default createWorkspace((workspace) => {
workspace.use(
buildLibraryWorkspace(),
eslint(),
prettier({files: '**/*.{md,json,yaml,yml}'}),
jest(),
workspaceTypeScript(),
runWorkspaceTests(),
);
});
Expand Down
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,14 @@
"@babel/core": "^7.14.6",
"@faker-js/faker": "^5.5.3",
"@shopify/app-bridge": "^2.0.3",
"@shopify/babel-preset": "^24.1.2",
"@shopify/babel-preset": "^24.1.4",
"@shopify/browserslist-config": "^2.2.4",
"@shopify/eslint-plugin": "^40.2.3",
"@shopify/loom": "^0.7.0",
"@shopify/loom-cli": "^0.7.0",
"@shopify/loom-plugin-babel": "^0.3.0",
"@shopify/loom-plugin-eslint": "^0.5.0",
"@shopify/loom-plugin-jest": "^0.6.0",
"@shopify/loom-plugin-package-build": "^0.7.0",
"@shopify/loom-plugin-prettier": "^0.2.0",
"@shopify/loom-plugin-typescript": "^0.8.0",
"@shopify/loom": "^1.0.1",
"@shopify/loom-cli": "^1.0.1",
"@shopify/loom-plugin-build-library": "^1.0.1",
"@shopify/loom-plugin-eslint": "^2.0.0",
"@shopify/loom-plugin-prettier": "^2.0.0",
"@shopify/typescript-configs": "^5.0.0",
"@types/faker": "^5.5.9",
"@types/react": "17.0.13",
Expand All @@ -59,6 +56,7 @@
"babel-loader": "^8.0.6",
"cross-fetch": "^3.0.4",
"element-closest": "^3.0.1",
"eslint": "^7.0.0",
"fs-extra": "^9.1.0",
"full-icu": "^1.3.0",
"get-port": "^5.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/address-consts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 3.0.6 - 2021-09-24

Expand Down
5 changes: 2 additions & 3 deletions packages/address-consts/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/address-mocks/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 2.0.13 - 2022-01-06

Expand Down
5 changes: 2 additions & 3 deletions packages/address-mocks/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/address/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 3.0.13 - 2022-01-06

Expand Down
5 changes: 2 additions & 3 deletions packages/address/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/admin-graphql-api-utilities/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 1.0.5 - 2021-09-24

Expand Down
5 changes: 2 additions & 3 deletions packages/admin-graphql-api-utilities/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/ast-utilities/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 1.3.0 - 2022-01-06

Expand Down
9 changes: 4 additions & 5 deletions packages/ast-utilities/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({name: 'javascript', root: './src/javascript'});
pkg.entry({name: 'markdown', root: './src/markdown'});
pkg.entry({root: './src/index.ts'});
pkg.entry({name: 'javascript', root: './src/javascript/index.ts'});
pkg.entry({name: 'markdown', root: './src/markdown/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/async/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 3.1.0 - 2021-12-01

Expand Down
7 changes: 3 additions & 4 deletions packages/async/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({name: 'babel', root: './src/babel-plugin'});
pkg.entry({root: './src/index.ts'});
pkg.entry({name: 'babel', root: './src/babel-plugin.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/browser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 2.0.5 - 2021-11-01

Expand Down
5 changes: 2 additions & 3 deletions packages/browser/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/csrf-token-fetcher/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 1.0.4 - 2021-09-24

Expand Down
5 changes: 2 additions & 3 deletions packages/csrf-token-fetcher/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/css-utilities/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 2.0.5 - 2021-09-24

Expand Down
5 changes: 2 additions & 3 deletions packages/css-utilities/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/dates/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 1.1.0 - 2022-01-28

Expand Down
5 changes: 2 additions & 3 deletions packages/dates/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/decorators/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 2.0.4 - 2021-09-24

Expand Down
5 changes: 2 additions & 3 deletions packages/decorators/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/function-enhancers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 2.0.4 - 2021-09-24

Expand Down
5 changes: 2 additions & 3 deletions packages/function-enhancers/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/graphql-config-utilities/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]
- Clean test output. [[#2091](https://github.com/Shopify/quilt/pull/2091)]

## 3.0.6 - 2021-11-22
Expand Down
5 changes: 2 additions & 3 deletions packages/graphql-config-utilities/loom.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {createPackage, Runtime} from '@shopify/loom';
import {createPackage} from '@shopify/loom';

import {quiltPackage} from '../../config/loom';

export default createPackage((pkg) => {
pkg.runtimes(Runtime.Browser, Runtime.Node);
pkg.entry({root: './src/index'});
pkg.entry({root: './src/index.ts'});
pkg.use(quiltPackage());
});
1 change: 1 addition & 0 deletions packages/graphql-fixtures/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- Reorder exports map to prioritize the `esnext` condition. [[#2148](https://github.com/Shopify/quilt/pull/2148)]
- Update Loom build config. [[#2150](https://github.com/Shopify/quilt/pull/2150)]

## 1.2.1 - 2022-01-26

Expand Down
Loading