create-rslib 0.0.0 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present Bytedance, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ <picture>
2
+ <img alt="Rslib Banner" src="https://assets.rspack.dev/rslib/rslib-banner.png">
3
+ </picture>
4
+
5
+ # Rslib
6
+
7
+ Rslib is a library build tool powered by [Rsbuild](https://rsbuild.dev). It allows library developers to leverage the knowledge and ecosystem of webpack and Rspack.
8
+
9
+ <!-- ## Documentation
10
+
11
+ https://rslib.dev/ -->
12
+
13
+ ## Contributing
14
+
15
+ Please read the [Contributing Guide](https://github.com/web-infra-dev/rslib/blob/main/CONTRIBUTING.md).
16
+
17
+ ## License
18
+
19
+ Rslib is [MIT licensed](https://github.com/web-infra-dev/rslib/blob/main/LICENSE).
package/bin.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import './dist/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ import { fileURLToPath as __webpack_fileURLToPath__ } from "url";
2
+ import { dirname as __webpack_dirname__ } from "path";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_create_rstack__ from "create-rstack";
5
+ var external_node_path_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_path__;
6
+ var external_create_rstack_namespaceObject = __WEBPACK_EXTERNAL_MODULE_create_rstack__;
7
+ var src_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
8
+ async function getTemplateName({ template }) {
9
+ if ('string' == typeof template) {
10
+ const pair = template.split('-');
11
+ const language = pair[1] ?? 'js';
12
+ const type = pair[0];
13
+ return `${type}-${language}`;
14
+ }
15
+ const type = (0, external_create_rstack_namespaceObject.checkCancel)(await (0, external_create_rstack_namespaceObject.select)({
16
+ message: 'Select template',
17
+ options: [
18
+ {
19
+ value: 'example',
20
+ label: 'Example'
21
+ }
22
+ ]
23
+ }));
24
+ const language = (0, external_create_rstack_namespaceObject.checkCancel)(await (0, external_create_rstack_namespaceObject.select)({
25
+ message: 'Select language',
26
+ options: [
27
+ {
28
+ value: 'ts',
29
+ label: 'TypeScript'
30
+ },
31
+ {
32
+ value: 'js',
33
+ label: 'JavaScript'
34
+ }
35
+ ]
36
+ }));
37
+ return `${type}-${language}`;
38
+ }
39
+ function mapESLintTemplate(templateName) {
40
+ const language = templateName.split('-')[1];
41
+ return `vanilla-${language}`;
42
+ }
43
+ (0, external_create_rstack_namespaceObject.create)({
44
+ root: external_node_path_namespaceObject["default"].resolve(src_dirname, '..'),
45
+ name: 'rslib',
46
+ templates: [
47
+ 'example-js',
48
+ 'example-ts'
49
+ ],
50
+ getTemplateName,
51
+ mapESLintTemplate
52
+ });
package/package.json CHANGED
@@ -1,11 +1,49 @@
1
1
  {
2
2
  "name": "create-rslib",
3
- "version": "0.0.0",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
3
+ "version": "0.0.5",
4
+ "description": "Create a new Rslib project",
5
+ "homepage": "https://rslib.dev",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/web-infra-dev/rslib",
9
+ "directory": "packages/create-rslib"
10
+ },
11
+ "license": "MIT",
12
+ "type": "module",
13
+ "exports": {
14
+ ".": "./dist/index.js"
15
+ },
16
+ "main": "./dist/index.js",
17
+ "bin": {
18
+ "create-rslib": "./bin.js"
19
+ },
20
+ "files": [
21
+ "template-*",
22
+ "dist",
23
+ "bin.js"
24
+ ],
25
+ "dependencies": {
26
+ "create-rstack": "1.0.1"
8
27
  },
9
- "author": "",
10
- "license": "MIT"
11
- }
28
+ "devDependencies": {
29
+ "@types/fs-extra": "^11.0.4",
30
+ "@types/node": "~18.19.39",
31
+ "fs-extra": "^11.2.0",
32
+ "rslib": "npm:@rslib/core@0.0.4",
33
+ "typescript": "^5.5.4",
34
+ "@rslib/tsconfig": "0.0.1"
35
+ },
36
+ "engines": {
37
+ "node": ">=16.7.0"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public",
41
+ "provenance": true,
42
+ "registry": "https://registry.npmjs.org/"
43
+ },
44
+ "scripts": {
45
+ "build": "rslib build",
46
+ "dev": "rslib build --watch",
47
+ "start": "node ./dist/index.js"
48
+ }
49
+ }
@@ -0,0 +1,23 @@
1
+ # Rslib Project
2
+
3
+ ## Setup
4
+
5
+ Install the dependencies:
6
+
7
+ ```bash
8
+ pnpm install
9
+ ```
10
+
11
+ ## Get Started
12
+
13
+ Build the library:
14
+
15
+ ```bash
16
+ pnpm build
17
+ ```
18
+
19
+ Build the library in watch mode:
20
+
21
+ ```bash
22
+ pnpm build --watch
23
+ ```
@@ -0,0 +1,13 @@
1
+ # Local
2
+ .DS_Store
3
+ *.local
4
+ *.log*
5
+
6
+ # Dist
7
+ node_modules
8
+ dist/
9
+
10
+ # IDE
11
+ .vscode/*
12
+ !.vscode/extensions.json
13
+ .idea
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "rslib-vanilla-js",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "build": "rslib build",
7
+ "dev": "rslib build --watch"
8
+ },
9
+ "devDependencies": {
10
+ "@rslib/core": "workspace:*"
11
+ }
12
+ }
@@ -0,0 +1,5 @@
1
+ import { defineConfig } from '@rslib/core';
2
+
3
+ export default defineConfig({
4
+ lib: [{ format: 'esm' }],
5
+ });
@@ -0,0 +1,3 @@
1
+ export function example() {
2
+ return 'hello world';
3
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "rslib-example-ts",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "build": "rslib build",
7
+ "dev": "rslib build --watch"
8
+ },
9
+ "devDependencies": {
10
+ "@rslib/core": "workspace:*",
11
+ "typescript": "^5.5.4"
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ import { defineConfig } from '@rslib/core';
2
+
3
+ export default defineConfig({
4
+ lib: [{ format: 'esm' }],
5
+ });
@@ -0,0 +1,3 @@
1
+ export function example(): string {
2
+ return 'hello world';
3
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["DOM", "ES2020"],
5
+ "module": "ESNext",
6
+ "noEmit": true,
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "isolatedModules": true,
10
+ "resolveJsonModule": true,
11
+ "moduleResolution": "bundler",
12
+ "useDefineForClassFields": true,
13
+ "allowImportingTsExtensions": true
14
+ },
15
+ "include": ["src"]
16
+ }