Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pre/postpublish tasks #144

Closed
wants to merge 4 commits into from

Conversation

martinmcwhorter
Copy link

gulp prepublish

Will MOVE the source *.ts (but not *.d.ts) files to ts/ directory before publishing to npm.

gulp postpublish

Will MOVE the source .ts (!.d.ts) file back from the ts/ directory after publishing npm.

@valorkin
Copy link
Member

valorkin commented Feb 5, 2016

is it not easier to add some .ts files to .npmignore and just copy files to git ignored ts folder?

@valorkin
Copy link
Member

valorkin commented Feb 5, 2016

not need to recreate PRs, just squash commits or git commit --ammend and force push to your master

@martinmcwhorter
Copy link
Author

is it not easier to add some .ts files to .npmignore and just copy files to git ignored ts folder?

That would work as well. If that is your preference I can update the PR?

not need to recreate PRs, just squash commits or git commit --ammend and force push to your master

Yes. I took the non-optimal hard approach. I won't be doing that again.

@valorkin
Copy link
Member

valorkin commented Feb 5, 2016

If that is your preference I can update the PR?

yes please
any way to make it without gulp?
like script for gh-pages?

@martinmcwhorter
Copy link
Author

Sure I can do it without gulp and tie it to the npm prepublish task. So all you would have to do is npm publish. How does that sound?

@valorkin
Copy link
Member

valorkin commented Feb 5, 2016

sounds awesome to me

@valorkin
Copy link
Member

valorkin commented Feb 7, 2016

ok, looks good, thx
I am currently playing with doc for usage from webpack
and will try your PR

PS: I will squash commits anyway :)

@valorkin
Copy link
Member

valorkin commented Feb 7, 2016

oh, crap
with this approach it just blow ups with issues:

EXCEPTION: No Directive annotation found on Alert
and
WARNING in ../ng2-bootstrap/~/rxjs/Subject.js
Cannot find source file '../../src/Subject.ts': Error: Cannot resolve 'file' or 'directory' ../../src/Subject.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs

WARNING in ../ng2-bootstrap/~/rxjs/Observable.js
Cannot find source file '../../src/Observable.ts': Error: Cannot resolve 'file' or 'directory' ../../src/Observable.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs

WARNING in ../ng2-bootstrap/~/rxjs/operator/toPromise.js
Cannot find source file '../../../src/operator/toPromise.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/operator/toPromise.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/operator

WARNING in ../ng2-bootstrap/~/rxjs/observable/fromPromise.js
Cannot find source file '../../../src/observable/fromPromise.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/observable/fromPromise.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/observable

WARNING in ../ng2-bootstrap/~/rxjs/subject/SubjectSubscription.js
Cannot find source file '../../../src/subject/SubjectSubscription.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/subject/SubjectSubscription.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/subject

WARNING in ../ng2-bootstrap/~/rxjs/symbol/rxSubscriber.js
Cannot find source file '../../../src/symbol/rxSubscriber.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/symbol/rxSubscriber.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/symbol

WARNING in ../ng2-bootstrap/~/rxjs/Subscription.js
Cannot find source file '../../src/Subscription.ts': Error: Cannot resolve 'file' or 'directory' ../../src/Subscription.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs

WARNING in ../ng2-bootstrap/~/rxjs/Subscriber.js
Cannot find source file '../../src/Subscriber.ts': Error: Cannot resolve 'file' or 'directory' ../../src/Subscriber.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs

WARNING in ../ng2-bootstrap/~/rxjs/util/root.js
Cannot find source file '../../../src/util/root.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/util/root.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/util

WARNING in ../ng2-bootstrap/~/rxjs/scheduler/queue.js
Cannot find source file '../../../src/scheduler/queue.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/scheduler/queue.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/scheduler

WARNING in ../ng2-bootstrap/~/rxjs/util/SymbolShim.js
Cannot find source file '../../../src/util/SymbolShim.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/util/SymbolShim.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/util

WARNING in ../ng2-bootstrap/~/rxjs/util/noop.js
Cannot find source file '../../../src/util/noop.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/util/noop.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/util

WARNING in ../ng2-bootstrap/~/rxjs/util/tryOrOnError.js
Cannot find source file '../../../src/util/tryOrOnError.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/util/tryOrOnError.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/util

WARNING in ../ng2-bootstrap/~/rxjs/util/throwError.js
Cannot find source file '../../../src/util/throwError.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/util/throwError.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/util

WARNING in ../ng2-bootstrap/~/rxjs/scheduler/QueueScheduler.js
Cannot find source file '../../../src/scheduler/QueueScheduler.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/scheduler/QueueScheduler.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/scheduler

WARNING in ../ng2-bootstrap/~/rxjs/scheduler/FutureAction.js
Cannot find source file '../../../src/scheduler/FutureAction.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/scheduler/FutureAction.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/scheduler

WARNING in ../ng2-bootstrap/~/rxjs/scheduler/QueueAction.js
Cannot find source file '../../../src/scheduler/QueueAction.ts': Error: Cannot resolve 'file' or 'directory' ../../../src/scheduler/QueueAction.ts in /Users/valorkin/work/open-source/ng2-bootstrap/node_modules/rxjs/scheduler

@valorkin
Copy link
Member

valorkin commented Feb 7, 2016

WARNING in ../ng2-bootstrap/ng2-bootstrap.js Cannot find source file 'ng2-bootstrap.ts': Error: Cannot resolve 'file' or 'directory' ./ng2-bootstrap.ts in /Users/valorkin/work/open-source/ng2-bootstrap

@valorkin
Copy link
Member

valorkin commented Feb 7, 2016

@martinmcwhorter what if I will check this idea again if you will be able to run it with 'https://github.com/AngularClass/angular2-webpack-starter'
npm link should help to use local version of ng2-bootstrap
(there you will have to delete *.ts files as you were proposing initially)

@martinmcwhorter
Copy link
Author

Where is the work flow is that happening? Is that on npm publish?

@valorkin
Copy link
Member

valorkin commented Feb 8, 2016

@martinmcwhorter I have compiled, removed .ts files
did npm link in ng2-bootstrap folder
and npm ling ng2-bootstrap in webpack seed app
while it works fine with latest version, it was not able to work without ts
I will have to research it better, but I am sure it should work fine

@fkowal
Copy link
Contributor

fkowal commented Mar 9, 2016

can we speed up this pull?

i am using https://github.com/AngularClass/angular2-webpack-starter
after npm install --save ng2-bootstrap
and adding import 'ng2-bootstrap'; to polyfiily.ts

the the project doesn't compile

ERROR in ./~/ng2-bootstrap/components/ng2-bootstrap-config.ts
Module parse failed: /Users/maciej.kowalski/branches/flp/classification-admin/node_modules/ng2-bootstrap/components/ng2-bootstrap-config.ts Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| export enum Ng2BootstrapTheme {BS3 = 1, BS4 = 2}

after i remove all .ts files from node_modules/ng2-bootstrap/ leaving only .d.ts and .js
everything works nicely

@fkowal
Copy link
Contributor

fkowal commented Mar 9, 2016

checkout my example

git clone https://github.com/fkowal/angular2-webpack-starter.git -b ng2-bootstrap
cd ng2-bootstrap && npm install && find node_modules/ng2-bootstrap | grep "\.ts" | grep -v "\.d\.ts" | xargs rm && npm run build

to make the ERROR in ./~/ng2-bootstrap/components/ng2-bootstrap-config.ts
go away
i needed to add an exclude in webpack.config.js

{ test: /\.js$/, loader: "source-map-loader", exclude: [
        helpers.root('node_modules/rxjs'),
        helpers.root('node_modules/ng2-bootstrap')
      ] }

there is a comment
// TODO(gdi2290): exclude: [ helpers.root('node_modules/rxjs') ] fixed with rxjs 5 beta.3 release
but i don't know what it means in terms of rxjs so i don't know what the fix should be in ng2-bootstrap

this is a whole change is here fkowal/angular2-webpack-starter@504cc0a

@valorkin
Copy link
Member

valorkin commented Mar 9, 2016

what if I will push compiled files to dist folder?
And will leave .ts where it is now?

@fkowal
Copy link
Contributor

fkowal commented Mar 9, 2016

from what i understand
when i use

import 'ng2-bootstrap/ng2-bootstrap'

typescript prefers ng2-bootstrap/ng2-bootstrap.ts over ng2-bootstrap/ng2-boostrap.d.ts and .js

if there is no .ts file typescript will use ng2-bootstrap/ng2-bootstrap.d.ts info
and load ng2-bootstrap/ng2-bootstrap.js

Having .d.ts and .js in ng2-bootstrap/dist/ would require users to use
import 'ng2-bootstrap/dist/ng2-boostrap';

Speaking as a user it wouldn't be my preference.

Also looking and angular2 node_module, .ts are in /ts and .d.ts, .js are in /

@valorkin
Copy link
Member

valorkin commented Mar 9, 2016

yeah, agreed
for some reason moving ts files ts folder did not worked for me
should try again

@fkowal
Copy link
Contributor

fkowal commented Mar 9, 2016

Let me know if i can help ill Join gitter if that helps

@fkowal
Copy link
Contributor

fkowal commented Mar 10, 2016

how can we make progress with issue?

@valorkin
Copy link
Member

eventually solved with 686ef90

@valorkin valorkin closed this Mar 30, 2016
@fkowal
Copy link
Contributor

fkowal commented Mar 30, 2016

Great news

@valorkin
Copy link
Member

So the reason why I failed last time, my sentiments about source maps :)

@valorkin
Copy link
Member

valorkin commented Apr 1, 2016

@fkowal can you please check and approve that it is working fine for you?

@fkowal
Copy link
Contributor

fkowal commented Apr 1, 2016

@valorkin it looks like it's working on it's own

after upgrade i noticed that my extended version, that i was using stopped working

Template parse errors:
Can't bind to 'typeahead' since it isn't a known native property ("
        <input id="assignment_parameter"
           [(ngModel)]="parameterModel"
           [ERROR ->][typeahead]="getParameters(getContext())"
@Directive({
    selector: 'typeahead[ngModel], [ngModel][typeahead]',
    host: {
        '(blur)': 'onBlur()',
        '(keydown)': 'preventEnterAction($event)'
    }
})
export class CustomTypeahead extends Typeahead {
    constructor(cd:NgModel,
                element:ElementRef,
                renderer:Renderer,
                loader:DynamicComponentLoader) {

        super(cd, element, renderer, loader);
    }

    onBlur() {
        setTimeout(() => {
            super.hide();
        }, 300);
    }

    preventEnterAction(ev) {
        if (ev.which === 13) {
            ev.preventDefault();
        }
    }
}

i am not quite sure where the problem is it's probably not even related to the ng2-bootstrap itself
the onBlur is already fixed i see, i made a pull-request #359 to address the other issue

@fkowal
Copy link
Contributor

fkowal commented Apr 1, 2016

Great work on this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants