rock 0.3.1 → 0.8.13

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.
Files changed (77) hide show
  1. package/README.md +51 -196
  2. package/dist/src/bin.d.ts +2 -0
  3. package/dist/src/bin.d.ts.map +1 -0
  4. package/dist/src/bin.js +7 -0
  5. package/dist/src/bin.js.map +1 -0
  6. package/dist/src/index.d.ts +2 -0
  7. package/dist/src/index.d.ts.map +1 -0
  8. package/dist/src/index.js +2 -0
  9. package/dist/src/index.js.map +1 -0
  10. package/dist/src/lib/adHocTemplates.d.ts +13 -0
  11. package/dist/src/lib/adHocTemplates.js +366 -0
  12. package/dist/src/lib/adHocTemplates.js.map +1 -0
  13. package/dist/src/lib/checkDeprecatedOptions.d.ts +1 -0
  14. package/dist/src/lib/checkDeprecatedOptions.d.ts.map +1 -0
  15. package/dist/src/lib/checkDeprecatedOptions.js +60 -0
  16. package/dist/src/lib/checkDeprecatedOptions.js.map +1 -0
  17. package/dist/src/lib/cli.d.ts +6 -0
  18. package/dist/src/lib/cli.d.ts.map +1 -0
  19. package/dist/src/lib/cli.js +101 -0
  20. package/dist/src/lib/cli.js.map +1 -0
  21. package/dist/src/lib/plugins/clean.d.ts +2 -0
  22. package/dist/src/lib/plugins/clean.d.ts.map +1 -0
  23. package/dist/src/lib/plugins/clean.js +317 -0
  24. package/dist/src/lib/plugins/clean.js.map +1 -0
  25. package/dist/src/lib/plugins/fingerprint.d.ts +12 -0
  26. package/dist/src/lib/plugins/fingerprint.d.ts.map +1 -0
  27. package/dist/src/lib/plugins/fingerprint.js +72 -0
  28. package/dist/src/lib/plugins/fingerprint.js.map +1 -0
  29. package/dist/src/lib/plugins/logConfig.d.ts +14 -0
  30. package/dist/src/lib/plugins/logConfig.d.ts.map +1 -0
  31. package/dist/src/lib/plugins/logConfig.js +54 -0
  32. package/dist/src/lib/plugins/logConfig.js.map +1 -0
  33. package/dist/src/lib/plugins/remoteCache.d.ts +2 -0
  34. package/dist/src/lib/plugins/remoteCache.d.ts.map +1 -0
  35. package/dist/src/lib/plugins/remoteCache.js +335 -0
  36. package/dist/src/lib/plugins/remoteCache.js.map +1 -0
  37. package/dist/src/lib/plugins/templateIndexHtml.d.ts +5 -0
  38. package/dist/src/lib/plugins/templateIndexHtml.js +189 -0
  39. package/dist/src/lib/plugins/templateIndexHtml.js.map +1 -0
  40. package/dist/src/lib/plugins/templateManifestPlist.d.ts +8 -0
  41. package/dist/src/lib/plugins/templateManifestPlist.js +36 -0
  42. package/dist/src/lib/plugins/templateManifestPlist.js.map +1 -0
  43. package/package.json +31 -44
  44. package/.npmignore +0 -1
  45. package/CHANGELOG.md +0 -61
  46. package/LICENSE +0 -15
  47. package/bin/rock +0 -51
  48. package/lib/rock.js +0 -191
  49. package/lib/tweezers.js +0 -43
  50. package/lib/util.js +0 -10
  51. package/test/mocha.opts +0 -3
  52. package/test/resources/expect/myapp/LICENSE +0 -15
  53. package/test/resources/expect/myapp/README.md +0 -18
  54. package/test/resources/expect/myapp/ignore_this/READTHIS.md +0 -1
  55. package/test/resources/expect/myapp/lib/cool_module.js +0 -4
  56. package/test/resources/expect/myapp/test/cool_module.test.js +0 -4
  57. package/test/resources/rock.conf.json +0 -3
  58. package/test/resources/rocks/node-lib/.rock/rock.json +0 -9
  59. package/test/resources/rocks/node-lib/.rock/scripts/bye.js +0 -1
  60. package/test/resources/rocks/node-lib/.rock/scripts/hi.sh +0 -3
  61. package/test/resources/rocks/node-lib/LICENSE +0 -15
  62. package/test/resources/rocks/node-lib/README.md +0 -18
  63. package/test/resources/rocks/node-lib/ignore_this/READTHIS.md +0 -1
  64. package/test/resources/rocks/node-lib/lib/{{project-name}}.js +0 -4
  65. package/test/resources/rocks/node-lib/test/{{project-name}}.test.js +0 -4
  66. package/test/resources/rocks/node-lib-tmpl/.rock/rock.json +0 -13
  67. package/test/resources/rocks/node-lib-tmpl/.rock/scripts/bye.js +0 -1
  68. package/test/resources/rocks/node-lib-tmpl/.rock/scripts/hi.sh +0 -3
  69. package/test/resources/rocks/node-lib-tmpl/LICENSE +0 -15
  70. package/test/resources/rocks/node-lib-tmpl/README.md +0 -18
  71. package/test/resources/rocks/node-lib-tmpl/ignore_this/READTHIS.md +0 -1
  72. package/test/resources/rocks/node-lib-tmpl/lib/@@project-name@@.js +0 -4
  73. package/test/resources/rocks/node-lib-tmpl/test/@@project-name@@.test.js +0 -4
  74. package/test/rock-bin.test.js +0 -81
  75. package/test/rock-dload-github.test.js +0 -54
  76. package/test/rock-file.test.js +0 -49
  77. package/test/rock.test.js +0 -90
package/README.md CHANGED
@@ -1,229 +1,84 @@
1
+ <a href="https://www.callstack.com/open-source?utm_campaign=generic&utm_source=github&utm_medium=referral&utm_content=rock" align="center">
2
+ <picture>
3
+ <img alt="Rock" src="https://github.com/user-attachments/assets/417baa3c-ae36-447f-baf9-1e0f423c3433">
4
+ </picture>
5
+ </a>
6
+ <p align="center">
7
+ 🪨 Rock is a cross-platform React Native app development and build toolchain built for modularity, build reuse, and incremental adoption. It integrates seamlessly with your existing infrastructure, giving you complete control without vendor lock-in.
8
+ </p>
1
9
 
10
+ ---
2
11
 
3
- Node.js - rock
4
- =================
12
+ ## React Native at scale is challenging
5
13
 
6
- Rock generates file structures or project skeletons based off of predefined templates. You can find a list of all of the templates on the [Github rocktemplates page][1].
14
+ Enterprise apps aren't built overnight. As maintainers of the Community CLI and partners to enterprise teams, we've seen the real challenges: high build times, difficulty adopting new third-party cloud services, and high barriers to introducing React Native into existing iOS and Android apps.
7
15
 
16
+ Rock simplifies native build setup and reuse. In most React Native codebases, only about 10% of code changes affect the native iOS/Android files. Yet most teams rebuild their native apps constantly—on every commit, PR, or merge to main—when it's completely unnecessary.
8
17
 
9
- Why?
10
- ----
18
+ Rock leverages this insight by providing intelligent caching in your cloud infrastructure, seamlessly integrated through its CLI. This allows you to skip up to 90% of unnecessary native builds.
11
19
 
12
- Do you constantly finding yourself writing a lot of new libraries for Node.js and having to create the `package.json`, `README`, `LICENSE`, `lib/`, `test/` files over and over again? Well, I did. Sometimes I was writing JavaScript libraries or CoffeeScript apps. But over and over I was getting annoyed of having to create the same file structure over and over again.
20
+ ## Features
13
21
 
14
- I stumbled upon a few solutions, but they all seem to do more than just generate a file structure from a template. That's all I wanted. Oh, and I wanted it to be programmatic too. So, if I wanted to build a blogging engine or another Rails clone in JS, I could leverage `rock` to generate the empty templates.
22
+ **🖥️ Brand New CLI**
23
+ A familiar CLI experience with end-to-end development and build workflows. Migrate in just 10 minutes.
15
24
 
16
- As it stands now, `rock` is written in Node.js. But the actual templates themselves could be for any language.
25
+ **☁️ Reusable Cloud Builds**
26
+ Reliable caching of native artifacts (APK, IPA) that you can store wherever you prefer, or use our out-of-the-box integrations with GitHub, S3, and R2.
17
27
 
28
+ **🔧 GitHub Actions**
29
+ Complete logic for downloading, uploading, and building native artifacts for iOS (APP, IPA) and Android (APK, AAB).
18
30
 
31
+ **🔗 Plug-and-Play Brownfield**
32
+ Package your React Native app as a framework and integrate it into your iOS and Android apps just like any other library.
19
33
 
20
- Installation
21
- ------------
34
+ **📦 Bundler Flexibility**
35
+ Rock supports both Metro and Re.Pack for JavaScript bundling. With Re.Pack, you can build Super Apps and Mobile Microfrontends.
22
36
 
23
- You will need Node.js and `npm` (Node.js Package Manager). This is included in the downloadable Node.js packages. If you don't have `npm`, mozy on over to the [latest Node.js package page][2]. There are prebuilt binaries and installers for most platforms including Mac OS X, Windows, and Linux.
37
+ **🔌 Extensible Plugin System**
38
+ Built with modularity in mind, Rock allows you to extend its capabilities through plugins that integrate with both the CLI and native templates.
24
39
 
25
- After you have installed Node.js and npm, you can install rock by running the following command:
40
+ ## Installation
26
41
 
27
- npm install -g rock
42
+ Rock is designed for incremental adoption. Whether you're just starting with React Native in your iOS or Android app, or want to migrate from the React Native Community CLI, you can do it step-by-step without having to figure everything out at once.
28
43
 
29
- Don't forget the **-g** flag. This will ensure that the `rock` command is available system wide.
44
+ ### Migrating an existing Community CLI project
30
45
 
31
- **Note:**
32
- At this time, `rock` requires `git` to be installed. This is because all the templates are hosted on Github. Since Github also provides tarballs and zipballs, this requirement will change soon.
46
+ To migrate an existing project, open a terminal in your project root and run:
33
47
 
34
-
35
- ### After Install
36
-
37
- After install, `rock` will create the file `rockconf.json` in your `~/.rock/` directory. You can modify this file to include additional repositories if you like.
38
-
39
-
40
-
41
- Usage
42
- -----
43
-
44
- rock [path] -r [rock]
45
-
46
- example:
47
-
48
- rock mylib -r node-lib
49
- or
50
-
51
- rock /tmp/mylib -r node-lib
52
-
53
-
54
- ### Options
55
-
56
- Options:
57
- --version Print version and exit.
58
- -r ROCK, --rock ROCK The rock path or Github repo.
59
- -c, --config The config file. Defaults to ~/.rock/rock.conf.json
60
-
61
-
62
- want to create a project from a rock hosted somewhere else? No problem:
63
-
64
- rock myapp -r git@github.com:johndoe/myrepo.git
65
-
66
- or use Github shorthand a la [component](https://github.com/component/component)
67
-
68
- rock myapp -r johndoe/myrepo
69
-
70
-
71
- Make Your Own Rocks
72
- -------------------
73
-
74
- It's stupidly simple to make your own rocks. Create a Git repository on Github or an empty directory on your filesystem. Start making template files.
75
-
76
- Example (myproject.js):
77
-
78
- ```javascript
79
- /*
80
- Author: {{author}} <{{email}}>
81
- File: {{file}}
82
- Created: {{date}}
83
- */
84
-
85
- function main() {
86
-
87
- }
48
+ ```shell
49
+ npm create rock-app
88
50
  ```
89
51
 
90
- Now, when you run:
91
-
92
- rock myproj -r /path/to/my/rock/repo
93
-
94
- Rock will prompt:
95
-
96
- author: [YOU_TYPE_YOUR_NAME_HERE]
97
- email: [YOU_TYPE_YOUR_EMAIL_HERE]
98
-
99
-
100
- Rock, then will create the file structure of your new project with the values of your template tokens replaced with what you typed. Rock already understands `file`, `date`, and few others.
52
+ ### Creating a new project
101
53
 
102
- ### Ignore Directories
54
+ To create a fresh React Native app with Rock, open a terminal and run:
103
55
 
104
- In your rock repo, add a file `.rock/rock.json`. Add the following:
105
-
106
- ```json
107
- {
108
- "ignoreDirs": ["./dirToIgnore"]
109
- }
56
+ ```shell
57
+ npm create rock-app
110
58
  ```
111
59
 
112
- Why would you do this? Let's say that you're calling rock programmatically and you don't want rock to prompt you for any tokens because you are going to use Mustache/Hogan/Handlebars in your own code.
113
-
114
-
115
- ### Open / Close Templates
60
+ ### Adding to an existing native project
116
61
 
117
- If you don't want to use the default `{{` and `}}` and want to use something else, you can configure this behavior for your Rock:
62
+ To add React Native to an existing iOS or Android app with Rock, use our Brownfield plugins:
118
63
 
119
- ```json
120
- {
121
- "tokens": {
122
- "open": "#{",
123
- "close": "}"
124
- }
125
- }
64
+ ```shell
65
+ npm create rock-app
66
+ # ...
67
+ ◆ What plugins do you want to start with?
68
+ │ ◼ brownfield-ios
69
+ ◼ brownfield-android
126
70
  ```
127
71
 
128
- You may want to do this if you generate files that actually use Mustache templates.
129
-
130
-
131
-
132
- Single File Rocks
133
- -----------------
134
-
135
- Rock doesn't need to be used with just whole repos. It can be used with individual files as well.
136
-
137
- **Example:**
138
-
139
- **http://localhost/data.txt**:
140
- ```
141
- Hi, @@author@@ is going to build:
142
- @@project-name@@.
143
- ```
144
-
145
- command:
146
-
147
- rock /tmp/outputfile.txt -f --topen '@@' --tclose '@@' -r http://localhost/data.txt
148
-
149
-
150
- prompts:
151
-
152
- ```
153
- author: JP
154
- project-name: Rock
155
- ```
156
-
157
- output:
158
-
159
- **/tmp/outputfile.txt**:
160
- ```
161
- Hi, JP is going to build:
162
- Rock
163
- ```
164
-
165
-
166
-
167
- rock.conf.json
168
- --------------
169
-
170
- This file defaults to `~/.rock/rock.conf.json`. You can set default values (prompt or skip).
171
-
172
- ```json
173
- {
174
- "templateValues": {
175
- "author": "JP Richardson"
176
- },
177
- "defaultValues": {
178
- "email": "jprichardson@gmail.com"
179
- }
180
- }
181
- ```
182
-
183
- So, if you were to run:
184
-
185
- rock myapp -r rocktemplates/node-bin
186
-
187
- it would not prompt you for `author` and it would prompt you for `email` but with a default of `jprichardson@gmail.com`.
188
-
189
-
190
-
191
- Rocks
192
- ------
193
-
194
- See more rocks at: https://github.com/rocktemplates or browse 3rd party Rocks here: https://github.com/rocktemplates/rock/wiki/rocks
195
-
196
-
197
- [1]: https://github.com/rocktemplates
198
- [2]: http://nodejs.org/dist/latest/
199
-
200
-
201
-
202
- Roadmap to v1.0.0
203
- ------------------
204
-
205
- - Will probably change configuration from JSON to [TOML](https://github.com/mojombo/toml). TOML needs to
206
- achieve stability first.
207
- - Create/fork site similar to [component.io](http://component.io/)
208
-
209
-
210
- Contributors
211
- ------------
212
-
213
- - (*) [JP Richardson](http://github.com/jprichardson)
214
- - (1) [Tayler Summers](https://github.com/taylers)
215
-
72
+ For detailed instructions, please follow our [Integrating with Native Apps](https://rockjs.dev/docs/brownfield/intro) documentation.
216
73
 
217
- License
218
- -------
74
+ ## Documentation
219
75
 
220
- (The MIT License)
76
+ Visit [rockjs.dev](https://rockjs.dev) to learn more about the framework, why we created it, how it can be useful to you, and how to use it in more advanced scenarios.
221
77
 
222
- Copyright (c) 2012-2013, JP Richardson
78
+ ## Contributing
223
79
 
80
+ Read our [contributing guidelines](CONTRIBUTING.md) to learn how you can contribute with bug reports, documentation, and code.
224
81
 
225
- [aboutjp]: http://about.me/jprichardson
226
- [twitter]: http://twitter.com/jprichardson
227
- [procbits]: http://procbits.com
228
- [gitpilot]: http://gitpilot.com
82
+ ## Made with ❤️ at Callstack
229
83
 
84
+ Rock is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Callstack](https://www.callstack.com/?utm_source=github.com&utm_medium=referral&utm_campaign=rock&utm_term=readme-with-love) is a group of React and React Native geeks. Contact us at [hello@callstack.com](mailto:hello@callstack.com) if you need any help with these technologies or just want to say hi!
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { cli } from './lib/cli.js';
3
+ cli({
4
+ argv: process.argv,
5
+ cwd: process.cwd(),
6
+ });
7
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,GAAG,CAAC;IACF,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './lib/cli.js';
2
+ export type { Config } from '@rock-js/config';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './lib/cli.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare function templateIndexHtml({ appName, version, bundleIdentifier, }: {
2
+ appName: string;
3
+ version: string;
4
+ bundleIdentifier: string;
5
+ }): string;
6
+ export declare function templateManifestPlist({ baseUrl, ipaName, bundleIdentifier, version, appName, platformIdentifier, }: {
7
+ baseUrl: string;
8
+ ipaName: string;
9
+ bundleIdentifier: string;
10
+ version: string;
11
+ appName: string;
12
+ platformIdentifier: string;
13
+ }): string;