File tree 4 files changed +95
-0
lines changed
4 files changed +95
-0
lines changed Original file line number Diff line number Diff line change
1
+ # build artefacts
2
+ build
3
+
4
+ # npm
5
+ node_modules
6
+
7
+ # Logs
8
+ logs
9
+ * .log
10
+ npm-debug.log *
11
+
12
+ # Optional npm cache directory
13
+ .npm
14
+
15
+ package-lock.json
Original file line number Diff line number Diff line change
1
+ # ` process ` for Sketch
2
+
3
+ All the [ nodejs process] ( https://nodejs.org/api/process.html ) API is available but some might just be stubs.
4
+
5
+ The only additional key we are setting is ` type ` which matches what electron is doing and its value is ` sketch ` . Pretty useful to create script that does different things depending on where it's running.
Original file line number Diff line number Diff line change
1
+ var toObject = require ( 'util' ) . toObject
2
+
3
+ var currentLocale = ( function currentLocale ( ) {
4
+ // NSLocale.currentLocale() only returns the language that is supported by the host application
5
+ var languageCode = String ( NSLocale . preferredLanguages ( ) [ 0 ] ) . split ( '-' ) [ 0 ]
6
+ if ( ! languageCode ) {
7
+ return undefined
8
+ }
9
+ var countryCode = String ( NSLocale . currentLocale ( ) . localeIdentifier ( ) ) . split ( '_' ) [ 1 ]
10
+ if ( ! countryCode ) {
11
+ return languageCode
12
+ }
13
+ return languageCode + '-' + countryCode
14
+ } ) ( )
15
+
16
+ module . exports = {
17
+ get title ( ) {
18
+ return String ( __command . name ( ) )
19
+ } ,
20
+ get version ( ) {
21
+ var pluginBundle = __command . pluginBundle ( )
22
+ return pluginBundle ? String ( pluginBundle . version ( ) ) : '0.0.0'
23
+ } ,
24
+ get versions ( ) {
25
+ var pluginBundle = __command . pluginBundle ( )
26
+ return {
27
+ plugin : pluginBundle ? String ( pluginBundle . version ( ) ) : '0.0.0' ,
28
+ sketch : MSApplicationMetadata . metadata ( ) . appVersion
29
+ }
30
+ } ,
31
+ arch : "x64" ,
32
+ platform : "darwin" ,
33
+ get env ( ) {
34
+ var env = toObject ( NSProcessInfo . processInfo ( ) . environment ( ) )
35
+ var pluginBundle = __command . pluginBundle ( )
36
+ env . command = __command
37
+ if ( pluginBundle ) {
38
+ env . plugin = pluginBundle
39
+ }
40
+ if ( currentLocale ) {
41
+ env . LANG = currentLocale
42
+ }
43
+ return env
44
+ } ,
45
+ get pid ( ) {
46
+ return __command . identifier
47
+ }
48
+ execPath : String ( NSBundle . mainBundle ( ) . executablePath ( ) ) ,
49
+ type : "sketch" ,
50
+ nextTick : typeof setImmediate !== 'undefined' ? setImmediate : undefined
51
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " @skpm/process" ,
3
+ "version" : " 0.1.0" ,
4
+ "description" : " Drop-in replacement for the process NodeJS global" ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "test" : " echo \" Error: no test specified\" && exit 1"
8
+ },
9
+ "repository" : {
10
+ "type" : " git" ,
11
+ "url" : " git+https://github.com/skpm/process.git"
12
+ },
13
+ "keywords" : [
14
+ " sketch" ,
15
+ " module" ,
16
+ " process"
17
+ ],
18
+ "author" :
" Mathieu Dutour <[email protected] > (http://mathieu.dutour.me/)" ,
19
+ "license" : " MIT" ,
20
+ "bugs" : {
21
+ "url" : " https://github.com/skpm/process/issues"
22
+ },
23
+ "homepage" : " https://github.com/skpm/process#readme"
24
+ }
You can’t perform that action at this time.
0 commit comments