Skip to content

Commit

Permalink
[zero] Prepare zero-runtime packages for public release (#41226)
Browse files Browse the repository at this point in the history
  • Loading branch information
brijeshb42 authored Feb 23, 2024
1 parent 1d02294 commit eb40f54
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 23 deletions.
12 changes: 10 additions & 2 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
"packages/mui-system",
"packages/mui-types",
"packages/mui-utils",
"packages-internal/scripts"
"packages-internal/scripts",
"packages/zero-runtime",
"packages/zero-unplugin",
"packages/zero-vite-plugin",
"packages/zero-next-plugin"
],
"publishDirectory": {
"@mui/base": "packages/mui-base/build",
Expand All @@ -42,7 +46,11 @@
"@mui/system": "packages/mui-system/build",
"@mui/types": "packages/mui-types/build",
"@mui/utils": "packages/mui-utils/build",
"@mui-internal/docs-utils": "packages/docs-utils"
"@mui-internal/docs-utils": "packages/docs-utils",
"@mui/zero-runtime": "packages/zero-runtime",
"@mui/zero-unplugin": "packages/zero-unplugin",
"@mui/zero-vite-plugin": "packages/zero-vite-plugin",
"@mui/zero-next-plugin": "packages/zero-next-plugin"
},
"sandboxes": [
"/examples/material-ui-cra-ts",
Expand Down
7 changes: 6 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"extends": "nx/presets/npm.json",
"targetDefaults": {
"copy-license": {
"cache": true,
"outputs": ["{projectRoot}/LICENSE"]
},
"build": {
"cache": true,
"dependsOn": ["^build"]
"dependsOn": ["copy-license", "^build"],
"outputs": ["{projectRoot}/build"]
}
}
}
1 change: 1 addition & 0 deletions packages/zero-next-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LICENSE
21 changes: 19 additions & 2 deletions packages/zero-next-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@
"main": "build/index.js",
"module": "build/index.mjs",
"types": "build/index.d.ts",
"private": true,
"author": "MUI Team",
"description": "Next.js integration for @mui/zero-runtime CSS-in-JS library.",
"repository": {
"type": "git",
"url": "https://github.com/mui/material-ui.git",
"directory": "packages/zero-next-plugin"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/mui/material-ui/issues"
},
"homepage": "https://github.com/mui/material-ui/tree/master/packages/zero-runtime",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"clean": "rimraf build types",
"watch": "tsup --watch --tsconfig tsconfig.build.json",
"copy-license": "node ../../scripts/zero-runtime-license.mjs",
"build": "tsup --tsconfig tsconfig.build.json",
"typecheck": "tsc --noEmit -p ."
},
Expand All @@ -30,6 +46,7 @@
"next-font.js",
"next-image.js",
"zero-virtual.css",
"package.json"
"package.json",
"LICENSE"
]
}
1 change: 1 addition & 0 deletions packages/zero-runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/processors/
/utils/
/extendTheme/
LICENSE
45 changes: 37 additions & 8 deletions packages/zero-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,48 @@
"main": "build/index.js",
"module": "build/index.mjs",
"types": "build/index.d.ts",
"private": true,
"author": "MUI Team",
"description": "A zero-runtime CSS-in-JS library.",
"repository": {
"type": "git",
"url": "https://github.com/mui/material-ui.git",
"directory": "packages/zero-runtime"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/mui/material-ui/issues"
},
"homepage": "https://github.com/mui/material-ui/tree/master/packages/zero-runtime",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"clean": "rimraf build types processors utils",
"clean": "rimraf build extendTheme types processors utils",
"watch": "tsup --watch --clean false",
"copy-license": "node ../../scripts/zero-runtime-license.mjs",
"build": "tsup",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/zero-runtime/**/*.test.{js,ts,tsx}'",
"test:ci": "cd ../../ && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov --report-dir=./coverage/zero mocha 'packages/zero-runtime/**/*.test.{js,ts,tsx}'",
"typecheck": "tsc --noEmit -p ."
},
"dependencies": {
"csstype": "^3.1.3",
"cssesc": "^3.0.0",
"clsx": "^2.1.0",
"@babel/core": "^7.23.9",
"@babel/helper-module-imports": "^7.22.15",
"@babel/helper-plugin-utils": "^7.22.5",
"@babel/parser": "^7.23.9",
"@babel/types": "^7.23.9",
"@emotion/css": "^11.11.2",
"@emotion/serialize": "^1.1.3",
"@emotion/styled": "^11.11.0",
"@emotion/react": "^11.11.3",
"@mui/system": "workspace:^",
"@wyw-in-js/processor-utils": "^0.4.1",
"@wyw-in-js/shared": "^0.4.1",
"@wyw-in-js/transform": "^0.4.1",
"@mui/system": "workspace:^",
"clsx": "^2.1.0",
"cssesc": "^3.0.0",
"csstype": "^3.1.3",
"lodash": "^4.17.21",
"stylis": "^4.3.1"
},
Expand Down Expand Up @@ -64,12 +82,13 @@
"files": [
"build",
"exports",
"extendTheme",
"processors",
"theme",
"utils",
"package.json",
"styles.css",
"theme",
"extendTheme"
"LICENSE"
],
"exports": {
".": {
Expand Down Expand Up @@ -121,6 +140,16 @@
}
},
"nx": {
"targetDefaults": {
"build": {
"outputs": [
"{projectRoot}/build",
"{projectRoot}/extendTheme",
"{projectRoot}/processors",
"{projectRoot}/utils"
]
}
},
"targets": {
"test": {
"cache": false,
Expand Down
1 change: 1 addition & 0 deletions packages/zero-unplugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LICENSE
23 changes: 20 additions & 3 deletions packages/zero-unplugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,38 @@
"main": "build/index.js",
"module": "build/index.mjs",
"types": "build/index.d.ts",
"private": true,
"author": "MUI Team",
"description": "Webpack integration for @mui/zero-runtime CSS-in-JS library.",
"repository": {
"type": "git",
"url": "https://github.com/mui/material-ui.git",
"directory": "packages/zero-unplugin"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/mui/material-ui/issues"
},
"homepage": "https://github.com/mui/material-ui/tree/master/packages/zero-runtime",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"clean": "rimraf build types",
"watch": "tsup --watch --tsconfig tsconfig.build.json",
"copy-license": "node ../../scripts/zero-runtime-license.mjs",
"build": "tsup --tsconfig tsconfig.build.json",
"typecheck": "tsc --noEmit -p ."
},
"dependencies": {
"@babel/core": "^7.23.9",
"@mui/zero-runtime": "workspace:^",
"@wyw-in-js/shared": "^0.4.1",
"@wyw-in-js/transform": "^0.4.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"unplugin": "^1.7.1"
},
"devDependencies": {
"@mui/zero-runtime": "workspace:^",
"@types/babel__core": "^7.20.5"
},
"peerDependencies": {
Expand All @@ -31,6 +47,7 @@
},
"files": [
"build",
"package.json"
"package.json",
"LICENSE"
]
}
3 changes: 1 addition & 2 deletions packages/zero-unplugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import {
generateTokenCss,
generateThemeTokens,
} from '@mui/zero-runtime/utils';
import type { Theme as BaseTheme } from '@mui/zero-runtime/extendTheme';
import { extendTheme } from '@mui/zero-runtime/extendTheme';
import { extendTheme, type Theme as BaseTheme } from '@mui/zero-runtime/extendTheme';

type NextMeta = {
type: 'next';
Expand Down
1 change: 1 addition & 0 deletions packages/zero-vite-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/LICENSE
21 changes: 19 additions & 2 deletions packages/zero-vite-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@
"main": "build/index.js",
"module": "build/index.mjs",
"types": "build/index.d.ts",
"private": true,
"author": "MUI Team",
"description": "Vite integration for @mui/zero-runtime CSS-in-JS library.",
"repository": {
"type": "git",
"url": "https://github.com/mui/material-ui.git",
"directory": "packages/zero-vite-plugin"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/mui/material-ui/issues"
},
"homepage": "https://github.com/mui/material-ui/tree/master/packages/zero-runtime",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mui-org"
},
"scripts": {
"clean": "rimraf build",
"watch": "tsup --watch",
"copy-license": "node ../../scripts/zero-runtime-license.mjs",
"build": "tsup",
"typecheck": "tsc --noEmit -p ."
},
Expand All @@ -32,6 +48,7 @@
},
"files": [
"build",
"package.json"
"package.json",
"LICENSE"
]
}
12 changes: 9 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions scripts/zero-runtime-license.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as path from 'node:path';
import fse from 'fs-extra';
import { getWorkspaceRoot } from './utils.mjs';

async function run() {
const licenseFile = path.join(getWorkspaceRoot(), 'LICENSE');
const cwd = process.cwd();
await fse.copyFile(licenseFile, path.join(cwd, 'LICENSE'));
}

run();
16 changes: 16 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import * as path from 'node:path';
import fs from 'node:fs';
import { defineConfig } from 'tsup';

const pkgJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));

const licenseText = `/**
* ${pkgJson.name} v${pkgJson.version}
*
* @license ${pkgJson.license}
* This source code is licensed under the ${pkgJson.license} license found in the
* LICENSE file in the root directory of this source tree.
*/
`;

export default defineConfig({
entry: ['src/index.ts'],
outDir: 'build',
Expand All @@ -11,4 +24,7 @@ export default defineConfig({
cjsInterop: true,
dts: true,
silent: true,
banner: {
js: licenseText,
},
});

0 comments on commit eb40f54

Please sign in to comment.